Learner
Learner

Reputation: 98

javascript regex multiple pattern search

I am trying to write the regex to search the string

String :

{@CSS resources=",resources/css/page.css,/resources/css/global.css ," /}

Regex:

{@CSS resources=\s*"(.*?)"\s*\/}|(^,)|(,$)

Need to find leading and trailing commas with "resources"

Upvotes: 1

Views: 56

Answers (1)

Thomas Ayoub
Thomas Ayoub

Reputation: 29431

You can use this regex:

{@CSS resources=\s*"(\s*,\s*)*(.*?)(\s*,\s*)*"\s*\/}

and replace with {@CSS resources="$2" /}

Upvotes: 1

Related Questions