Simple explanation of Regex?

Is there a simple explanation of how to create Regex find and replace patterns?
I need to convert Czech dates like 31. října 1967 to 31 October 1967 and that kind of thing. I know it should be easy, and I have just about figure out how to actually find expressions, but not how to replace them. I would love to find some kind of resource that would teach Regex to a complete newbie with zero knowlege of programming rather than having to ask people to come up with solutions for me.

Parents Reply Children
  • Ah, that's the "plugin" option I was mentioning! So you are referring to Regex match Autosuggest provider the whole time! That's a completely different story... you should have mentioned that right at the beginning...

    In that case it's just the regex you got wrong - you missed the "\d" which means "digit", and you got the wrong brackets; different types of brackets have completely different meanings in regexes!

    Then it should be something like (it's better to define the spaces as optional, unless you are absolutely sure that they are always there):

    (\d{1,2})\.\s*(#czech_months#)\s*(\d{4})

    and the replace pattern would be the same as your original one:

    $1 $2 $3

    Still, unless your replacement table contains correct pairs for all inflected variations of Czech month names (or unless there are no inflected names in your text), I guess you might have a problem...

  • In the standard format, the name of the month in Czech is always the same (genitive).
    Thanks for the pattern. It works a treat. I've been translating quite a lot of history texts recently, and obviously dates keep coming up.

  • In the standard format, the name of the month in Czech is always the same (genitive).

    I happen to be Czech ;-), so I know very well that there is no "standard format" ;-). The format always depends on the context.

    I was born on 31st October 1967 => Narodil jsem se 31. října 1967
    What can you tell about 31st October 1967? => Co můžeš říct o 31. říjnu 1967?