#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2012
    Posts
    1
    Rep Power
    0

    Find all words between $ signs


    Hi,

    I am trying to develop a regex that will find all words in a string that start and end with $

    e.g. in the following string:
    "Hello, $how$ are $you$ doing?"

    I would want it to return either:
    how
    you

    or:
    $how$
    $you$

    (whichever is easiest).

    Please could someone help.

    Much appreciated!

    James
  2. #2
  3. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,053
    Rep Power
    9398
    Might be better to grab $how$ so any replacing you do will remove the $s as well.
    Code:
    /\$([^$]+)\$/

IMN logo majestic logo threadwatch logo seochat tools logo