如何使用正则表达式从字符串中跳过加号[+] [英] How to skip plus[+] sign from a string using regex

查看:100
本文介绍了如何使用正则表达式从字符串中跳过加号[+]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的正则表达式: @[^ A-Za-z0-9!@ $%& *() - =;:',。?/ \\\\ [\]]



我正在做的是从字符串中删除无效字符,但只加上[ + ]签到了。



这是我的测试字符串:

123!@#$ ~`abAB ~`!@ $ Now!@ $%& *() -  = [];:',。?/ +< br /> 



和输出是: 123!@ $ abAB!@ $ Now!@ $%& *() - = [];:',。?/ +



预期结果: 123!@ $ abAB!@ $ Now!@ $%& *() - = [];:',。?/



我也想跳过加号[ + ]的标志。请帮助我。

解决方案

%& *() - =;:',。?/ \\\\ [\]]



我正在做的是从字符串中删除无效字符但只加上[ + ]签署了。



这是我的测试字符串:

123!@#


〜`ABAB〜`!@

现在!@

Here is my regex: @"[^A-Za-z0-9!@$%&*()-=;:'"",.?/\s\[\]]"

and i am doing to remove invalid characters from a string but only plus[+] sign is left.

This is my testing string :

"123!@#$~`abAB~`!@$Now!@$%&*()-=[];:',.?/+"<br />


and output is: 123!@$abAB!@$Now!@$%&*()-=[];:',.?/+

Expected Result : 123!@$abAB!@$Now!@$%&*()-=[];:',.?/

I want to skip the plus[+] sign too. plz help me.

解决方案

%&*()-=;:'"",.?/\s\[\]]"

and i am doing to remove invalid characters from a string but only plus[+] sign is left.

This is my testing string :

"123!@#


~`abAB~`!@


Now!@


这篇关于如何使用正则表达式从字符串中跳过加号[+]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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