Taking fields out of a string

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hey,
I have a string (an document.rtf loaded in a stream and then via
streamreader.ReadToEnd i filled the string)

Ex. of the string

" My name is &replacename& My address is &replaceadress& ... "

Now i want just to take out of the names between the & and i want to put
then in an arrary of strings.

Result would be : [replacename,replaceadress]

I looked at regex.split, but is not what i want really.
Are there some other matching rules or things I can do.

Thanks for help
jac
 
Hi !
Jac wrote:
[...snip...]
" My name is &replacename& My address is &replaceadress& ... "

Now i want just to take out of the names between the & and i want to put
then in an arrary of strings.

Result would be : [replacename,replaceadress]

I looked at regex.split, but is not what i want really.
[...snip...]

Try something like (not tested):

Regex express = new Regex("&.*?&");
MatchCollection matches = express.Matches(yourString);
 
Back
Top