|
-
May 22nd, 2013, 11:56 PM
#1
Thread Starter
Frenzied Member
[RESOLVED] need help with regex
Hi,
I normally use the .Replace function in asp.net , which works fine, but this time I want it to be more strict.
The string I will be looking for will contain A-Z a-z 0-9 $ _
ex.
$EUROPE_FRANCE
$EUROPE_FRANCE_PARIS
...
There is no blank space between the words and it always start with a $ sign.
So my main issue with the .Replace function is , if I search for '$EUROPE_FRANCE' it will detect this twice '$EUROPE_FRANCE' and '$EUROPE_FRANCE_PARIS' . I have no clue about the regex syntax, but i read it's possible, so I was wondering if there is way to specify for regex to only search for exact match? Or even there is another function in asp.net that will allow me to do this.
Thank You
-
May 23rd, 2013, 12:13 AM
#2
Re: need help with regex
Hi,
Give this syntax a try:-
Code:
\$([0-9a-zA-Z_]{1,})
This will select any Single Word String that starts with a dollar character.
Hope that helps.
Cheers,
Ian
-
May 23rd, 2013, 01:05 AM
#3
Re: need help with regex
Hey,
For an online resource to help you with constructing the Regular Expression, be sure to check out this site:
http://gskinner.com/RegExr/
I use it all the time 
Gary
-
May 23rd, 2013, 11:18 AM
#4
Thread Starter
Frenzied Member
Re: need help with regex
@IanRyder Thanks, the syntax you provided was exactly what i needed 
@gep13 , nice tool , i will bookmark it.
thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|