Help with Regular Expression
Posted
by shivesh
on Stack Overflow
See other posts from Stack Overflow
or by shivesh
Published on 2010-06-18T07:57:06Z
Indexed on
2010/06/18
8:33 UTC
Read the original article
Hit count: 269
Hello I need help with Regular Expression,
I want to match each section (number and it's text - 2 groups), the text can be multi line, each section ends when another section starts (another number) or when .END is reached or EOF.
Demo
Expression:
\(\d{1,3}\) ([\s\S]*?)(\.END|\(\d{1,3}\))
Input text:
(1) some text some text
some text some text
some text some text
(2) some text some textsome text
(3) some textsome text
some textsome textsome text
(4) some text
.END
first group should match number (with brackets) and second group should match corresponded text.
© Stack Overflow or respective owner