Regular Expression questions

  • Thread starter Thread starter Derrick
  • Start date Start date
D

Derrick

Hi

I am new to using regular expressions in VB.NET, and need a bit of help.

I am trying to parse a string that looks like this:
~datastart some variable numbers, characters and spaces of unknown length~
to get this
~datastart~

I tried this:
strWorkingData = Regex.Replace(strWorkingData, "~datastart*~",
"~datastart~")
but it returned the starting value

Any help would be appreciated (including any good resources on how to use
regular expressions)

Thanks for the help

Derrick
 
try ~(datastart[^~]*)~

that might work.

test string "fjsgf~datastart453~~~~3232~datastart.--$#2~#@@~datastart @//+_)(*&^@ 4 ~fdas#@$#@fdsfd" should return 3 matches.


----- Derrick wrote: -----

Hi

I am new to using regular expressions in VB.NET, and need a bit of help.

I am trying to parse a string that looks like this:
~datastart some variable numbers, characters and spaces of unknown length~
to get this
~datastart~

I tried this:
strWorkingData = Regex.Replace(strWorkingData, "~datastart*~",
"~datastart~")
but it returned the starting value

Any help would be appreciated (including any good resources on how to use
regular expressions)

Thanks for the help

Derrick
 
Thank you - That worked perfectly.

Derrick

tMan said:
try ~(datastart[^~]*)~

that might work.

test string "fjsgf~datastart453~~~~3232~datastart.--$#2~#@@~datastart
@//+_)(*&^@ 4 ~fdas#@$#@fdsfd" should return 3 matches.
 
Back
Top