>mstr='1st-title: ANAME-HER : 3520931 place[21-22]' >? GETWORDNUM(mstr, 1, ':') + ':' + GETWORDNUM(mstr, 2, ':') + ':' + CHRTRAN(GETWORDNUM(mstr, 3, ':'), '-', '.') >Having to consider nothing more than the original (and even subsequent) Karen's requirements, in"pure" VFP this would do:
m.mstr = "1st-title: ANAME-HER : 3520931 place[21-22]" ? LEFT(m.mstr,RAT("[",m.mstr)) + CHRTRAN(SUBSTR(m.mstr,RAT("[",m.mstr)+1)," +=-~",".....")The rationale for the use of regular expressions, though, is that it widens the coverage of variations handling without having to change code, just pattern data. For instance,
? PATTERNTRAN("1st-title: [1-2] ANAME-HER:HIS : 3520931 place[ 21 ~ 22] ", "\[\s*(\d+)[^\d]+(\d+)\s*\]\s*$","[$1.$2]")would cover other variations and introduce a boost in data normalization (that's what Karen is looking for).