vb.net - RegEx to match tokens and keep delimiter -


I want to match all the tokens of these strokes and the delimiter (to keep separate capturing groups) this RegEx (vb .net):

([^ ~ \ + \:] *) ([~ \ + \:])

Text1 + Text2:: Text4 :: Text6 ~ Text1 + Text2: Text3 + Text4 ~

Output:

Text1 + Text2 :: Text4 :: Text6 ~ Text1 + Text2: Text3 + text4 ~

As the escape addimeter I ? How can I get it with (strange number of ? )?

Text1 + Text2 ?: Text3 ~

The result of

Text1 + Text2 ?: Text3 ~

Thank you for your help

Try it out: < Pre> ((?: \?. | | | [^ ~ +:]) *) ([~ +:])


It will not necessarily be ? A in a or ?? Avoid in , then you will need to post something - even without processing, a ? will effectively escape the next character if: ?: will not be a delimiter, ??: will be a delimiter, ???: < / Code> there will be no limit. / P>


Explanation:

  (Capture group for text # is started) (?: (? # Non-capture for repeat changes Start the group) \? (? # Match? Is actually being followed by any character - to avoid) | (? # OR) [^ ~ +:] (? # No non-delimiter characters found ~, +, And :)) * (? # Repeat non-capture group (0 # time)) (? Capture Capture group) (Captive group starts for # delimiter?) [~ +:] (? # Matches any delimiter character ~, +, Su :)) (? # Capture Capture)    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -