regex - How do I exclude a word from a regular expression search? -


how can create regular expression following problem:

i have string,
name1=value1;name2=value2;.....;

somewhere, there exists pair, "begin=10072011;" need, regular expressions, parse string name=value; pairs, value number. however, want ignore name begin

currently have following regexp:

([\\w]+)=([\\d]+); 

mine selects begin name. how can change not include begin?

(?!begin)\b(\w+)=(\d+);

this uses negative lookahead, not match if string starts "begin". \b necessary regex not skip "b" , match "egin=...".

note when describing regex should using single backslash escapes, although languages need use double backslashes escape backslash.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

android - layout with fragment and framelayout replaced by another fragment and framelayout -