我有一个字符串:
[device]Some device[/device]
我正在尝试编写仅返回“某些设备”的正则表达式。
/[device](.*?)[/device]/i.exec(str) // doesn't work
/[device](.*)[\/device]/g.exec(text) // doesn't work
我不确定如何提取它?
我已经尝试过来自Regular Expression to get a string between two strings in Javascript的解决方案,但它不适用于像[][/]
这样的字符串。
[device]Some device[/device]
返回
evice]Some device[/device] and all other strings.