Regex: How can I capitalize the first letter that immediately follows a number EXCEPT for 1st, 2nd, 3rd, etc -
so i'm editing regex code mass mp3 rename tool , hoping there's code capitalize every letter follows number. instance, 2nite > 2nite , 221b > 221b keep 11th > 11th , 2nd > 2nd unchanged.
you don't language you're using. here's you'd in perl
s/(?<=\d)(?!(?:st|nd|rd|th)\b)([[:lower:]])/\u$1/g
where
(?<=\d)
behind digit(?!(?:st|nd|rd|th)\b)
ahead not "st" or "nd" or ...\b
word boundary marker,1st
stays intact1stop
becomes1stop
([[:lower:]])
lower case letter (captured)\u$1
in replacement side, upper case first letter of text in first capturing parentheses
Comments
Post a Comment