G'd Afternoon all. I have a reg-ex script for converting Roman numerals, but it seems to have a bug in it. In particular, the numerals "II, IV, VI VIII, XII and XIV come out as "Ii, Iv, Vi, Viii, Xii and Xiv". Here is the action, see if you can find the problem:
Action: Replace with regular expression
Field:_ALL
Regular expression: (?:^|\s|[|/)(?:C{0,3}|C)(?:X{0,3}|X[C])(?:V?I{0,3}|I[VX])(?:.|\s|)|$|:)
Replace matches with: $upper($0)
[ ] case-sensitive comparison
Before starting this thread, I searched the forum for other options, and found this post. The action is described as follows:
RE: Capitalize Roman Numerals up to 89.
Field:_Tag
re:(?<=[^\w']|_)(?:L?X{0,3}|XL)(?:V?I{0,3}|I[VX])(?=\W|_|$)
re:^(?:L?X{0,3}|XL)(?:V?I{0,3}|I[VX])(?=\W|_)
$upper($0)
I find this confusing, as there seems to be two different reg ex's here. If I discard the second one, it seems to work ok, but begs the question: what is the second line for? So, with only the first reg ex line included, is this a viable action?
Action: Replace with regular expression
Field:_ALL
Regular expression: (?<=[^\w']|_)(?:L?X{0,3}|XL)(?:V?I{0,3}|I[VX])(?=\W|_|$)
Replace matches with: $upper($0)
[ ] case-sensitive comparison
By the way, in case anyone should offer an alternative script, I should make it clear that I don't wish to convert large numerals, only up 100 at most. Thanks.