删除指定字符前后的空白区域 [英] Remove white-space before / after specified character

查看:101
本文介绍了删除指定字符前后的空白区域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

非常新的RegEx



我需要删除斜杠前后的空格" /"字符串中的字符(如果存在)



Ex

查找/替换其他内容>>查找/替换其他东西



查找/替换其他东西>>查找/替换其他东西



查找/替换其他东西>>找到/替换其他东西我正在尝试,.replace(/ [/] + $ / g,"")但它没有效果



尝试这个但是没有运气



  .replace(/ [/] + $ / g,"")



谢谢

Very new to RegEx

I need to remove whitespace before and after the slash "/" character in a string if it exists

Ex
find/ replace other stuff >> find/replace other stuff

find /replace other stuff >> find/replace other stuff

find / replace other stuff >> find/replace other stuffI am trying, .replace(/[/]+$/g, "")but it has no effect

Trying this but no luck

 .replace(/[/]+$/g, "")

Thanks

推荐答案

尝试替换"\ * * [/] \ s *" with"/"。

或"\ + +(?= [/])|(?< = [/])\s +"使用""。


这篇关于删除指定字符前后的空白区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆