Jot remark
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
Jot remark
CHET-NUN
Peace, my fellow TextPad workers.
I am quite busy and full of other thoughts and am here with hopes someone more literate in regular expressions will give me instructions on how to change
a colon :
to a jot '
in a large number of mainly identically formatted xhtml files
I will probably need to step through the search to replace only those
colons in the places I really want and make sure I do not recklessly adjust any header/footer code.
[edit] I would like to change
Exodus 20:3
to
Exodus 20'3
but not change any other colon.[/edit]
Thanks much,
JB
Peace, my fellow TextPad workers.
I am quite busy and full of other thoughts and am here with hopes someone more literate in regular expressions will give me instructions on how to change
a colon :
to a jot '
in a large number of mainly identically formatted xhtml files
I will probably need to step through the search to replace only those
colons in the places I really want and make sure I do not recklessly adjust any header/footer code.
[edit] I would like to change
Exodus 20:3
to
Exodus 20'3
but not change any other colon.[/edit]
Thanks much,
JB
Last edited by Bekah on Mon Jan 01, 2007 11:30 pm, edited 1 time in total.
You probably need to give a more specific example but what follows may be useful.
Make sure the regular expression checkbox is ticked and enable POSIX regular expression syntax in the Editor preferences.
Will search for a colon that is not surrounded by numbers and will replace that colon with a single quote character. This means that Exodus 20:3 remains unchanged but test:case becomes test'case. The brackets in the search expression define references that can be used in the replacement expression as \1, \2 etc.
Hope this helps but a an example showing the data (if possible) would be useful.
Code: Select all
Find What: ([^0-9]):([^0-9])
Replace with: \1'\2
Will search for a colon that is not surrounded by numbers and will replace that colon with a single quote character. This means that Exodus 20:3 remains unchanged but test:case becomes test'case. The brackets in the search expression define references that can be used in the replacement expression as \1, \2 etc.
Hope this helps but a an example showing the data (if possible) would be useful.
CHET-NUN
Thank you, Steve, for the response. I tried your suggestion a few times but was unsuccessful. It found every colon except the Scripture citations.
You ask for example text. Here are some snippets from xhtml files. I hope this helps you help me.
<div class="cquote">"Let your loins
be girded about, and your lights burning; And ye yourselves like
unto men that wait for their lord, when he will return from the
wedding; that when he cometh and knocketh, they may open unto him
immediately." - Luke 12:35-36</div>
<blockquote class="scripture"><p>"And David took the crown of their king from off his head, and found it to weigh a talent of gold, and there were precious stones in it; and it was set upon David's head: and he brought also exceeding much spoil out of the city." - 1st Chron 20:2</p></blockquote>
There are usually from zero to at most 5 items like this in my xhtml files. What do you think now?
Peace to you,
Bekah
Thank you, Steve, for the response. I tried your suggestion a few times but was unsuccessful. It found every colon except the Scripture citations.
You ask for example text. Here are some snippets from xhtml files. I hope this helps you help me.
<div class="cquote">"Let your loins
be girded about, and your lights burning; And ye yourselves like
unto men that wait for their lord, when he will return from the
wedding; that when he cometh and knocketh, they may open unto him
immediately." - Luke 12:35-36</div>
<blockquote class="scripture"><p>"And David took the crown of their king from off his head, and found it to weigh a talent of gold, and there were precious stones in it; and it was set upon David's head: and he brought also exceeding much spoil out of the city." - 1st Chron 20:2</p></blockquote>
There are usually from zero to at most 5 items like this in my xhtml files. What do you think now?
Peace to you,
Bekah
I may have misunderstood what you were after - that is what I expected to happen.It found every colon except the Scripture citations.
When I ran the search it matched the colon between head and and but did not match those in Luke 12:35-36 and 1st Chron 20:2. Is it these last two that you want to change, leaving the actual text unchanged?
CHET-NUN means grace.
I would like to change
a colon :
to a jot '
in citations only.
The replacement routine should leave this intact:
http://gifts.beckah.com
but make this
Exodus 20:3
look like this
Exodus 20'3
Is it do-able?
Peace and thanks for all the help.
Bekah
I would like to change
a colon :
to a jot '
in citations only.
The replacement routine should leave this intact:
http://gifts.beckah.com
but make this
Exodus 20:3
look like this
Exodus 20'3
Is it do-able?
Peace and thanks for all the help.
Bekah
- Bob Hansen
- Posts: 1516
- Joined: Sun Mar 02, 2003 8:15 pm
- Location: Salem, NH
- Contact:
I understood your original request the same as he did.
It sounds like you need to change SteveH's solution to only change the colon if it is surrounded by numbers.
Change his solution from:
Find What: ([^0-9]):([^0-9])
Replace with: \1'\2
Change To:
Find What: ([0-9]):([0-9])
Replace with: \1'\2
Using Regex and POSIX as he noted in his reply.
It sounds like you need to change SteveH's solution to only change the colon if it is surrounded by numbers.
Change his solution from:
Find What: ([^0-9]):([^0-9])
Replace with: \1'\2
Change To:
Find What: ([0-9]):([0-9])
Replace with: \1'\2
Using Regex and POSIX as he noted in his reply.
Hope this was helpful.............good luck,
Bob
Bob
- Bob Hansen
- Posts: 1516
- Joined: Sun Mar 02, 2003 8:15 pm
- Location: Salem, NH
- Contact:
How about doing three passes?
Pass 1, replaces time colons with tildes
Pass 2, replaces colons with jot
Pass 3, replaces tildes with colons
Pass 1:
Search for: :([0-9])([0-9]):
Replace with: ~\1\2~
Pass 2:
Search for: ([0-9]):([0-9])
Replace with: \1'\2
Pass 3:
Search for: ~
Replace with: :
------------------------------------
Can combine all three into a macro and call macro.
Pass 1, replaces time colons with tildes
Pass 2, replaces colons with jot
Pass 3, replaces tildes with colons
Pass 1:
Search for: :([0-9])([0-9]):
Replace with: ~\1\2~
Pass 2:
Search for: ([0-9]):([0-9])
Replace with: \1'\2
Pass 3:
Search for: ~
Replace with: :
------------------------------------
Can combine all three into a macro and call macro.
Hope this was helpful.............good luck,
Bob
Bob
CHET-NUN
Very good!
The process is a good one for a later application, however, because I did the diligent deed already yesterday, by hand. It was not too hard, for I did hundreds of files in small batches, and cleaned house in between.
I am certain more questions are coming up. Look for a new thread by me soon, inshallah (Lord willing).
You all are so good to share your thoughts and skills freely here. Bless you!
Peace be with you,
Bekah
Very good!
The process is a good one for a later application, however, because I did the diligent deed already yesterday, by hand. It was not too hard, for I did hundreds of files in small batches, and cleaned house in between.
I am certain more questions are coming up. Look for a new thread by me soon, inshallah (Lord willing).
You all are so good to share your thoughts and skills freely here. Bless you!
Peace be with you,
Bekah
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm