Home > Mobile >  javascript regex how to match only parts in a list with mandatory prefix
javascript regex how to match only parts in a list with mandatory prefix

Time:07-07

I want to match ": red", ": 10", ": [special]" only if category present before (I want to use replace function to get rid of them afterwards)

category fruit(color: red, size: 10, others: [special])

I have this regex for above

(((:\s*[\w\[\]] )(?=[,\)])) )

except for category, I can't seem to be able to use lookbehind for that.

CodePudding user response:

If we take the the following input verbatim

  • Related