Regular Expression questions

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
 
G

Guest

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
 
D

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top