Reputation: 1312
i have this string
<p> this is some text</p>
can be any number of times
to match i am using regex (?<=<p.*?>* )(.*)(?=</p>)
but i am getting this is some text
as output
How to get this is some text
EDIT
i am sorry my string is <p class='randomstring'>a) this is some text</p>
in place of a)
there is digit some times.
Upvotes: 0
Views: 279
Reputation: 785156
You can use this regex:
(?<=<p[^>]*>)(?: )+(.*)(?=</p>)
And grab the captured group #1 for you match, that will be:
this is some text
EDIT: Based on your edited question try this regex:
(?<=<p[^>]*>)[^)]*\) *(?: )+(.*)(?=</p>)
Upvotes: 3
Reputation: 174706
You could use the below regex which uses variable length positive lookbehind.
(?<=<p[^>]*>(?: )+)\b.*?(?=</p>)
This should match only the string this is some text
Update:
(?<=<p[^>]*>\w*\)(?: )+)\b.*?(?=</p>)
Upvotes: 2