Limit regex expression by character in c# -
i next pattern (\s\w+)
need matches every words in string space.
for example
when have string
many word in textarea must happy
i get
many word in textarea must happy
it correct, when have character, example
many word in textarea , must happy
i get
many word in textarea must happy
but must happy
should ignored, because want break when character in string
edit:
example 2
all cats { in } world nice
should return
all cats
because {
separator me
example 3
my 3 cats ... funny
should return
my 3 cats
because 3
alphanumeric , .
separator me
what can do?
to need utilize \g
anchors matches positions @ start of string or after lastly match. can pattern:
@"(?<=\g\s*)\w+"
c# regex
No comments:
Post a Comment