How to convert javascript regex to safe java regex?

前端 未结 3 489
广开言路
广开言路 2020-12-17 20:43
strOutput.replace(\"/{{[^]*?}}/g\",\"\");

Is there a way to convert JavaScript regexes to Java-safe regexes?

The above statement gives me t

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-17 21:17

    You wouldn't need the /'s (forward slashes at start and end) those are used in javascript for inline declaration instead of quotes.

    Should just be Regex r = new Regex("{{[^]*?}}"); ​​​​

提交回复
热议问题