Jot remark

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
Bekah
Posts: 11
Joined: Thu Jan 08, 2004 2:01 pm

Jot remark

Post by Bekah »

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
Last edited by Bekah on Mon Jan 01, 2007 11:30 pm, edited 1 time in total.
User avatar
SteveH
Posts: 327
Joined: Thu Apr 03, 2003 11:37 am
Location: Edinburgh, Scotland
Contact:

Post by SteveH »

You probably need to give a more specific example but what follows may be useful.

Code: Select all

Find What: ([^0-9]):([^0-9])

Replace with: \1'\2
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.
Bekah
Posts: 11
Joined: Thu Jan 08, 2004 2:01 pm

Post by Bekah »

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
User avatar
SteveH
Posts: 327
Joined: Thu Apr 03, 2003 11:37 am
Location: Edinburgh, Scotland
Contact:

Post by SteveH »

It found every colon except the Scripture citations.
I may have misunderstood what you were after - that is what I expected to happen.

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?
Bekah
Posts: 11
Joined: Thu Jan 08, 2004 2:01 pm

Post by Bekah »

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
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

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.
Hope this was helpful.............good luck,
Bob
Bekah
Posts: 11
Joined: Thu Jan 08, 2004 2:01 pm

Post by Bekah »

CHET-NUN means grace.

Didn't I say I was busy?

Yes, I made a mistake in my first post. But I [edited] it.

Let me try your solution, and get back to you.

You guys are so bright! Thanks much.

Bekah
Bekah
Posts: 11
Joined: Thu Jan 08, 2004 2:01 pm

Post by Bekah »

CHET-NUN means mercy.

Your regular exp. is working perfectly to change Scripture citations, but it also is catching time signatures, such as hh:mm:ss.

I have to step through the search anyway, so it is not hard to skip those.

Thanks again, so much and
peace be with you.

Bekah
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

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.
Hope this was helpful.............good luck,
Bob
Bekah
Posts: 11
Joined: Thu Jan 08, 2004 2:01 pm

Post by Bekah »

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
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

This will avoid hitting times of day in a single pass:
Find what: ([^0-9:][0-9]+):([0-9]+([^0-9:]|$))
Replace with: \1'\2

[X] Regular expression
Post Reply