匹配字符串的正则表达式 [英] Regular Expression For Matching String

查看:127
本文介绍了匹配字符串的正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在使用正则表达式从字符串中获取特定格式.

下面是字符串.
javascript:__ doPostBack(''ctl00 $ MainContent $ TreeView1'',''sC:* | * \\ C:* | ** | *备份文件* | * \\ C:* | ** | *备份文件* | ** | *解决方案1 ​​ | *'')

从上面的字符串中,我只想获取 C:* | ** | *备份文件* | ** | * Solution1 * | * 部分.这个怎么做.我已经尝试过了.

mystr.match(/\ w {1} [:] [*] [|] [*] [*] [|] [*] [az AZ 0-9 \ s * |] */)

通过这种方法,我只得到 C:* | ** | * Backup Files * | * 部分.

请帮助

Hi,

I am using a regular expression for getting a specific format from a string.

Below is the string.
javascript:__doPostBack(''ctl00$MainContent$TreeView1'',''sC:*|*\\C:*|**|*Backup Files*|*\\C:*|**|*Backup Files*|**|*Solution1*|*'')

From the above string i want to fetch Only C:*|**|*Backup Files*|**|*Solution1*|* part. How to do this. I have tried this in my way.

mystr.match(/\w{1}[:][*][|][*][*][|][*][a-z A-Z 0-9\s*|]*/)

Through this method i am getting only the C:*|**|*Backup Files*|* part.

Please Help

推荐答案

MainContent
MainContent


TreeView1'',''sC:* | * \\ C:* | ** | *备份文件* | * \\ C:* | ** | *备份文件* | ** | *解决方案1 ​​ | *'')

从上面的字符串中,我只想获取 C:* | ** | *备份文件* | ** | * Solution1 * | * 部分.这个怎么做.我已经尝试过了.

mystr.match(/\ w {1} [:] [*] [|] [*] [*] [|] [*] [az AZ 0-9 \ s * |] */)

通过这种方法,我只得到 C:* | ** | * Backup Files * | * 部分.

请帮助
TreeView1'',''sC:*|*\\C:*|**|*Backup Files*|*\\C:*|**|*Backup Files*|**|*Solution1*|*'')

From the above string i want to fetch Only C:*|**|*Backup Files*|**|*Solution1*|* part. How to do this. I have tried this in my way.

mystr.match(/\w{1}[:][*][|][*][*][|][*][a-z A-Z 0-9\s*|]*/)

Through this method i am getting only the C:*|**|*Backup Files*|* part.

Please Help


这篇关于匹配字符串的正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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