Copy link to clipboard
Copied
Windows 10 64 bit, InD CC 2107
I'm working on an ePUB doc and I have to find a tab character within a specific, yet consistent text pattern and swap the tab for a space character. It always starts at the beginning of a paragraph, with a digit followed by a period mark. It may include some repetition of these characters like so:
3.4.1.4.5 tab more alpha text
I start my Grep like this just to see if it's working:
^\d\.[\d\.]*\t
which it does.
But when I try to load everything but the tab character into Positive Look Behind, but it doesn't find the tab:
(?<=^\d\.[\d\.]*)\t
What am I doing wrong?
(?-s)^(\d+\.?)+\K\t
(^/)
Copy link to clipboard
Copied
Did you try leaving out the ^ carat from the positive look-behind?
Copy link to clipboard
Copied
Try use \K instead of (?<=)
About \K usage you can read here (post 14 and further)
Copy link to clipboard
Copied
I tried leaving out the carrot ^, but I get: Cannot Find match.
I tried \K. It behaves the same way as ^\d\.[\d\.]*\t, meaning it finds and selects all of the characters, which isn't quite what I'm looking for. I need to isolate the tab after the digit(s) and period mark(s) and then swap it out with a space character. That's why I'm pretty sure I need Pos Look Behind - look behind the tab, confirm a match and then swap.
I have a feeling these characters that need to go inside Pos Look B-hind, need to get enclosed in something - brackets, curly braces, or parenthesis - I tried these but it didn't work. Maybe some combo of these?
Copy link to clipboard
Copied
(?-s)^(\d+\.?)+\K\t
(^/)
Copy link to clipboard
Copied
Obi,
thanks - it worked!
Big thanks to everyone else for their input!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now