正则表达式帮助! [英] Regex Help!
问题描述
大家好,
很长一段时间以来,我一直在努力使用正则表达式.我有一个非常大的文本文件(其中包含HTML代码),我需要根据以下内容从其中拉出页面:
我需要2分之间的一切:
开始:
TEXT(最多5个单行单词)+空格+ $(文字美元符号)+正数
分页符,以HTML表示:
所以,
正则表达式匹配从这里开始:
鞋子和短裤$ 2324 324
中:
(之间的所有字符)
结束:
" ...- break-before:总是>
先感谢您.为此,我将换一个月的良好业力(-:
干杯,
苏拉奇
=====
应该有3个匹配项(在10-100页的文档中)
Hello all,
I have been struggling with a regular expression for a long long time now. I have a very large text file (that has HTML code in it) and i need to pull out pages from it based on the following:
I need EVERYTHING between 2 points:
Start:
TEXT (up to 5 single spaced words) + SPACE + $ (literal dollar sign) + positive number
through the page break, represented in HTML:
So,
Regex Match Starts here:
Shoes and Shorts $ 2324 324
Middle:
(ALL CHARACTERS IN BETWEEN)
End:
""...-break-before:always''>
Thank you in advance. I''ll trade a month''s good karma for this (-:
Cheers,
Suraci
=====
There should be 3 matches (within a 10-100 page document)
推荐答案
(文字美元符号)+正数
分页符,以HTML表示:
所以,
正则表达式匹配从这里开始:
鞋子和短裤
(literal dollar sign) + positive number
through the page break, represented in HTML:
So,
Regex Match Starts here:
Shoes and Shorts
2324 324
中:
(之间的所有字符)
结束:
" ...- break-before:总是>
先感谢您.为此,我将换一个月的良好业力(-:
干杯,
苏拉奇
=====
应该有3个匹配项(在10-100页的文档中)
2324 324
Middle:
(ALL CHARACTERS IN BETWEEN)
End:
""...-break-before:always''>
Thank you in advance. I''ll trade a month''s good karma for this (-:
Cheers,
Suraci
=====
There should be 3 matches (within a 10-100 page document)
我认为这是满足您要求的正则表达式.
(\ w + \ s {1}){1,5} \
I think this is the regex which satisfies your requirement.
(\w+\s{1}){1,5}\
这篇关于正则表达式帮助!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!