I would like to remove 'a' or 'the' from the beginning of a string, and 'checklist' or 'procedures?' from the end of a string:
input examples:
A Detailed procedure
The flight checklist
Takeoff procedures
Desired output, respectively:
Detailed
flight
Takeoff
Using a variable
<xsl:sequence select="replace($string, '^(a|the)\s(.*)\s(procedures?|checklist)$', '$2', 'i')" />
is returning the complete $string but
<xsl:sequence select="replace('A flight checklist', '^(a|the)\s(.*)\s(procedures?|checklist)$', '$2', 'i')" />
returns flight as expected.
I would try
replace($string, '(^(a|the))|((procedures?|checklist)$)', '', 'i')or perhapsreplace($string, '(^(a|the)\s)|(\s(procedures?|checklist)$)', '', 'i').