Regex matching a string followed by anything but a certain character -


regex match every char following
didn't me.

i'm trying match momentaneousvehiclespeedkmph= followed 9 in gz file.

these don't match:

$zgrep "momentaneousvehiclespeedkmph=\[\^9\]" file.gz $zgrep "momentaneousvehiclespeedkmph=\(\^9\)" file.gz $zgrep "momentaneousvehiclespeedkmph=\^\[9\]" file.gz $zgrep "momentaneousvehiclespeedkmph=\^\(9\)" file.gz 

this does:

$zgrep "momentaneousvehiclespeedkmph=\(9\)" file.gz 

i there're lines in file containing momentaneousvehiclespeedkmph=89.

simply try

$zgrep "momentaneousvehiclespeedkmph=[^9]" file.gz

if don't want match single 9.

/edit

if need speeds 2 digits , more, try:

momentaneousvehiclespeedkmph=([0-8]|[0-9]{2,})\b


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -