I have this (/\;$/, "");
to remove last ; from a string. but the result is same as input.
我有这个(/ \; $ /,“”);删除最后;从一个字符串。但结果与输入相同。
1 个解决方案
#1
1
The following regex should work for you:
以下正则表达式应该适合您:
\;(?=[^;]*$)
So your replacement code would become:
所以你的替换代码将成为:
(\;(?=[^;]*$), "");
Here is an example of the regex working on RegExr.
以下是使用RegExr的正则表达式的示例。
#1
1
The following regex should work for you:
以下正则表达式应该适合您:
\;(?=[^;]*$)
So your replacement code would become:
所以你的替换代码将成为:
(\;(?=[^;]*$), "");
Here is an example of the regex working on RegExr.
以下是使用RegExr的正则表达式的示例。