locked
transposing dates with wildcards puts spaces at the end RRS feed

  • Question

  • I'm trying to change American formatted dates to British using the expression from this support site. My first problem is that (<[ADFJMNOS]*>) ([0-9]{1,2}), ([0-9]{4}) is finding the entire paragraph leading up to the date ending with a year. But when I use (January) ([0-9]{1,2}), ([0-9]{4}) and replace with \2 \1 \3 it transposes the date, but the spaces appear at the end of the replaced string (e.g. 18January2012[space][space]). What am I doing wrong?
    Saturday, December 29, 2012 4:59 PM

Answers

  • Try:

    Find = ([JFMASOND][!dfjkqwxz ]{2,8})( )([0-9]{1,2}), ([12][0-9]{3}>)
    Replace = \3\2\1\2\4


    Cheers
    Paul Edstein
    [MS MVP - Word]

    • Marked as answer by Max Meng Wednesday, January 2, 2013 5:07 AM
    Sunday, December 30, 2012 4:23 AM

All replies

  • Are you sure you used "\2 \1 \3" (without the quotes) in the Replace with box, and not "\2\1\3  " (without the quotes)?

    Regards, Hans Vogelaar

    Saturday, December 29, 2012 10:05 PM
  • Try:

    Find = ([JFMASOND][!dfjkqwxz ]{2,8})( )([0-9]{1,2}), ([12][0-9]{3}>)
    Replace = \3\2\1\2\4


    Cheers
    Paul Edstein
    [MS MVP - Word]

    • Marked as answer by Max Meng Wednesday, January 2, 2013 5:07 AM
    Sunday, December 30, 2012 4:23 AM