Find string using regex javascript -
i want find string ,whose last character may or may not present
"abc,efg,asd" "abc,asd,efg"
so, have find asd or without " , "
description
[,"](asd)[,"]
this regular expression following:
- match asd between commas or comma , quote,
- place value capture group 1
example
live demo
https://regex101.com/r/mv9va9/1
explanation
node explanation ---------------------------------------------------------------------- [,"] character of: ',', '"' ---------------------------------------------------------------------- ( group , capture \1: ---------------------------------------------------------------------- asd 'asd' ---------------------------------------------------------------------- ) end of \1 ---------------------------------------------------------------------- [,"] character of: ',', '"' ----------------------------------------------------------------------
Comments
Post a Comment