Home Forums Help needed regular expression request

Tagged: 

  • Author
    Posts
  • Avatarnefycee
    Participant
    Post count: 143

    I search an expression for my folders named named after date

    23-04-2010 or Name_23-04-2010 or 23-10-2010_Name

    Now I want a regex for the tabble "april" and it should only match these three kinds of folders ๐Ÿ˜•

  • AvatarJfw
    Participant
    Post count: 36

    Well I am not an expert in reg ex.
    But I would set soming like
    (anything followed by 2 numbers with exact expression "-04-" followed by 4 numbers followed by anything) or (anything followed by 4 numbers with exact expression "-04-" followed by 2 numbers followed by anything)

    my tentative:
    [0-9][0-9]-04-[0-9][0-9][0-9][0-9]|[0-9][0-9][0-9][0-9]-04-[0-9][0-9]

    Not sure this makes sence.
    Note: this is my first tentative for a regex expressoion ๐Ÿ˜ฏ

    Br
    Jf

  • AvatarAndrea
    Keymaster
    Post count: 916

    Hello guys!

    We’ve just spent a week of "forced holidays"…we were both extremely burned-out ๐Ÿ™‚
    Anyway, back to your question, you may want to check this link: http://www.regular-expressions.info/dates.html.

    The idea is that you should create a rule for each month and each year where you tell Tabbles: "whatever day, whatever year and the month of April -> put it in the tabble "April". So,

    .*[0-2][0-9].*|.*3[0-1].* = whatever day, followed or preceded by anything
    .*2000|2001|2002|2003|2004|2005|2006|2007|2008|2009|2010|.* = whatever year from 2000 to 2010, followed or preceded by anything

    .* = zero or more of any character
    . = any character, only once (it works with the "-" that nefycee needs)

    So, in nefycee’s example 23-04-2010 or Name_23-04-2010 or 23-10-2010_Name the expression for april may look like:

    .*([0-2][0-9]|3[0-1]).04.(2000|2001|2002|2003|2004|2005|2006|2007|2008|2009|2010).*

    That should work! Any volunteer to try this out? ๐Ÿ˜€

  • AvatarKaptK
    Participant
    Post count: 22

    I haven’t tested this yet in Tabbles but have run it through the tool Espresso which is good for testing regex.

    d{2}-04-d{4}

    It is matching 2 digits then the -04- for April and finally 4 digits for the year. Should work for you as i don’t think error checking needs to be done on the day/year part of the match.

    Sorry i just reread what you were after and i see i should tweak this some more.

    (?:w*_)?d{2}-04-d{4}(?:_w*)?

    ๐Ÿ˜€ Hope it works in Tabbles as it’s going fine in Espresso. I have to go Zzzz so will test it when i wake up in Tabbles.

  • Avatarnefycee
    Participant
    Post count: 143

    "KaptK" wrote:

    (?:w*_)?d{2}-04-d{4}(?:_w*)?

    This one works, thanks! ๐Ÿ˜€

  • AvatarAndrea
    Keymaster
    Post count: 916

    Cool! :mrgreen:

  • AvatarKaptK
    Participant
    Post count: 22

    "nefycee" wrote:

    (?:w*_)?d{2}-04-d{4}(?:_w*)?

    This one works, thanks! ๐Ÿ˜€

    Great! You will find that it matches Name_27-04-10_Name too but i hope that won’t matter ๐Ÿ˜‰

  • Avatarasimetron
    Participant
    Post count: 1

    Hi.
    I will be very grateful if someone can explain to me or create a regular expression, that reads the metadata of the author field in the word documents, so that I can label them by authors, subject, content, state, comment, episode, etc.

    The author is the one that interests me most.
    Thank you so much.

    Attachments:
    You must be logged in to view attached files.
    • AvatarAndrea
      Keymaster
      Post count: 916

      Hi there,

      I really don’t know how to do that, nor I know if it’s possible at all.

You must be logged in to reply to this topic.