• It does seem like that would be one instance where a CLR udf would do very well, especially to support more complex examples. That's precisely the type of thing regular expressions are good at.

    Although, string parsing like that in SQL typically smells like bad design or something that should have been done outside SQL in the first place.