Need A Regex To Modify A Second Match And Ignore The First And Last
Library context, using MarcEdit which can also use regex.
I need this:
=773 \\$tEtudes inuit$x0701-1008$1Vol. 44 1-2, $2p. 53-84
to be changed to this:
=773 \\$tEtudes inuit$x0701-1008$1Vol. 44, no. 1-2, $2p. 53-84
Problem is, the 44 in this case and the 1-2 are numbers that will change from one book to the other and I am building commands to automate it.
I tried focusing on changing the space between the 44 and the 1-2 into a ', no. ' with \s but it obiviously changes all spaces characters.
The adding ', no. ' is easy because there is a different box for it but I can't focus on the 2nd space while ignoring the first and last and also keeping every characters before and after.
Thank you for helping, I've been looking/trying all day!
Answer
If the regular expression implementation supports look ahead, you can require that this space is followed by a range and a comma:
Find: \s(?=\d+-\d+,)
Replace: , no.
Related Questions
- → How to replace *( in a string
- → Regex extract string after the second "." dot character at the end of a string
- → CodeMirror regex doesn't match behavior typical Javascript regex parser
- → JS Get multiple links in a string
- → Using capture group $1 to access object's key value
- → Difference between /(a|b)/ and /[ab]/ in JavaScript split() using regex
- → In Nginx, how to match and entire URL and Query String and redirect to a URL and Query String
- → Reorder lines in a string based on first two numbers inside
- → How to manage URL with or without ? and /
- → Not sure why this Regex is returning true
- → Laravel extract excerpt from content using tinymce
- → Cannot get my multiple regex working for specific case in URL structure
- → laravel5.1 validate number