The first rather than the last of something
Posted: Tue Oct 18, 2011 11:37 pm
Hi,
I'm trying to write something and I almost have it... almost...
What I have:
1. This needs to be bolded. The rest does not. There may be several. Sentences, that is.
What I need to end up
1. <p><b>This needs to be bolded.</b> The rest does not. There may be several. Sentences, that is.</p>
Searching: ([0-9]+)\. (.*\.) (.*)
replacing with: \1. <p><b>\2</b> \3</p>
got me this:
1. <p><b>This needs to be bolded. The rest does not. There may be several.</b> Sentences, that is.</p>
So it found the LAST period-space, not the first one.
When I tried the search using this: ([0-9]+)\. (.*)\. (.*)
I still got this:
1. <p><b>This needs to be bolded. The rest does not. There may be several</b> Sentences, that is.</p>
So I wondered, how do I get it to STOP at the FIRST period?
([0-9]+)\. ([.*.])(.*)
and
([0-9]+)\. ([.*\.])(.*)
Don't 'find' it. I thought adding the period in brackets after the 'find all' .* would say "go to that char and stop" but apparently not, and 'escaping' it didn't help.
Would appreciate any insight. Must be something obvious I'm missing.
PJ
I'm trying to write something and I almost have it... almost...
What I have:
1. This needs to be bolded. The rest does not. There may be several. Sentences, that is.
What I need to end up
1. <p><b>This needs to be bolded.</b> The rest does not. There may be several. Sentences, that is.</p>
Searching: ([0-9]+)\. (.*\.) (.*)
replacing with: \1. <p><b>\2</b> \3</p>
got me this:
1. <p><b>This needs to be bolded. The rest does not. There may be several.</b> Sentences, that is.</p>
So it found the LAST period-space, not the first one.
When I tried the search using this: ([0-9]+)\. (.*)\. (.*)
I still got this:
1. <p><b>This needs to be bolded. The rest does not. There may be several</b> Sentences, that is.</p>
So I wondered, how do I get it to STOP at the FIRST period?
([0-9]+)\. ([.*.])(.*)
and
([0-9]+)\. ([.*\.])(.*)
Don't 'find' it. I thought adding the period in brackets after the 'find all' .* would say "go to that char and stop" but apparently not, and 'escaping' it didn't help.
Would appreciate any insight. Must be something obvious I'm missing.
PJ