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
Post a Comment