Input String:
start skip three words end, April 25, 2024 # 725 ( John Doe )
Desired Result String:
start end 240425 #725
[1] RegEx not shown used to remove commas, pound-sign, and replace “April” with “04” (cheating here is OK 🙂
[2] Initial working RegEx so far, but ” ( John Doe )” still remains!! I can’t find a syntax that works. 🙁
(w+) (w+) (w+) (w+) (w+) (w+) (w+) (dd)(dd)
The first dd grabs the “20” and I keep the second dd which is “24”
[3] Group IDs to generate Desired Result String (except the John Doe part)
$1 $5 $9$6$7
The STRANGE part is that the ID numbers don’t match the word positions!!
$9 should actually be $8 because $8 in the Input String is “2024”. Yet I have to use $9 ??!!!
Is there something weird about using w+ instead of dd in the above?
(P.S. I’m using Advanced Renamer’s RegEx)
[4] I know there’s a way to remove “skip three words” more simply using something like “(w{3})”, but that doesn’t work! What have I missed?
And, I’ve tried all kinds of syntax E.g. (([^()]*)) to “find” the parentheses, spaces, and words. By NOT using the next group ID# ($10), it won’t be included in the final output I want to see (shown in “Desired Result String”)
P.S. As you can see, I barely understand RegEx but known enough to get into trouble!
Thank you for your time in unraveling my syntax!
Bruce
Bruce McLendon is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.