G
Guest
Hello All,
i have been cracking my skull on how to seach a particular reg exp match
within a string? it does not seem to happen except the whole arbitrary string
is the exact match of the regular expression specified....but the question is
how do i search for and get all or a number of specified matches within an
arbitrary long string. e.g
for example this is my reg exp i am using:
@"^-[A-Z][a-z]*-$" which will match any string within two full-stops "-"
and"-" example being :
-Cat-
but now how do i search and retreive that match and any other matches from
within a very long string such as:
this is a very long and pointless sentence where i am trying to
retreive-Cat-then -Dog-also something further along this overbearing sentence
at say this point -Man-.
hence retreive -Cat- , -Dog- and -Man-
Can this be done followed by an example please ?
because at the moment i can only match a match if the whole string is a
match! e.g if the whole string i want to find my match from is a match such
as "-Cat-" and that is not what i want i want to get a match or more matches
from a whole load of text...
geez this is giving me a headache just writing this as well!
thanks in advance..
i have been cracking my skull on how to seach a particular reg exp match
within a string? it does not seem to happen except the whole arbitrary string
is the exact match of the regular expression specified....but the question is
how do i search for and get all or a number of specified matches within an
arbitrary long string. e.g
for example this is my reg exp i am using:
@"^-[A-Z][a-z]*-$" which will match any string within two full-stops "-"
and"-" example being :
-Cat-
but now how do i search and retreive that match and any other matches from
within a very long string such as:
this is a very long and pointless sentence where i am trying to
retreive-Cat-then -Dog-also something further along this overbearing sentence
at say this point -Man-.
hence retreive -Cat- , -Dog- and -Man-
Can this be done followed by an example please ?
because at the moment i can only match a match if the whole string is a
match! e.g if the whole string i want to find my match from is a match such
as "-Cat-" and that is not what i want i want to get a match or more matches
from a whole load of text...
geez this is giving me a headache just writing this as well!
thanks in advance..