multiline regular expression with textpad

大憨熊 提交于 2019-12-23 10:17:05

问题


I can't figure out how to make textpad perform a regular expression that extends multiple lines.

I tried using perl syntax with /myregex/m with m as a modifier but that didnt' work. I can't see a checkbox or anything in the editor to tell it to do multiline.

anyone have any ideas?


回答1:


It is entirely possible, and simple :) You just use \n

This search:

we\nwill

Matches the end of line 1 and the start of line 2 in this dummy text:

this is a test and we
will see if it matches
multiple lines.



回答2:


Another way to do this is with [\s\S]. For example, if you wanted to find <option> tags in some HTML, you could search for:

<option[^>]*>[\s\S]*?</option>


来源:https://stackoverflow.com/questions/7300732/multiline-regular-expression-with-textpad

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!