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)[,"] 

regular expression visualization

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

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -