Tuesday, July 9, 2019

Match first occurrence

https://superuser.com/questions/266732/matching-only-the-first-occurrence-in-a-line-with-regex
^([^,]+),
That means
^        starts with
[^,]     anything but a comma
+        repeated one or more times (use * (means zero or more) if the first field can be empty)
([^,]+)  remember that part
,        followed by a comma

No comments:

Post a Comment