Loading ...
Sorry, an error occurred while loading the content.
 

Regular Expression to get away football team

Expand Messages
  • dvdwriters12
    Hi guys, This is a sample: Everton 1 - 0 Portsmouth Hull City 0 - 0 Liverpool Man Utd 4 - 0 Stoke City West Ham 1 - 1 Man City
    Message 1 of 9 , Jun 24, 2010
      Hi guys,

      This is a sample:

      "Everton 1 - 0 Portsmouth "
      "Hull City 0 - 0 Liverpool "
      "Man Utd 4 - 0 Stoke City "
      "West Ham 1 - 1 Man City "
      "Wolves 2 - 1 Sunderland"

      Taken from http://fantasy.premierleague.com/M/fixture.mc?event=38

      I need a regular expression (for GetDocMatchAll) to get the away team name into an array. In the above case it is, "Portsmouth, Liverpool, Stoke City, Man City, Sunderland".

      Anyone help ?
    • Don
      something like: .* d t{1,2}(.*) t.* Your last one is missing the trailing tab.
      Message 2 of 9 , Jun 24, 2010
        something like:
        .*\d \t{1,2}(.*)\t.*

        Your last one is missing the trailing tab.

        On 6/24/2010 12:14 PM, dvdwriters12 wrote:
        > "Everton 1 - 0 Portsmouth "
        > "Hull City 0 - 0 Liverpool "
        > "Man Utd 4 - 0 Stoke City "
        > "West Ham 1 - 1 Man City "
        > "Wolves 2 - 1 Sunderland"
      • diodeom
        ... This should work on your sample: ^!SetListDelimiter , x20 ^!SetArray %Away%=^$GetDocMatchAll(- x20 d+ x20 K.+?(?= x20? R))$ ^!Set
        Message 3 of 9 , Jun 24, 2010
          "dvdwriters12" <dvdwriters@...> wrote:
          >
          > Hi guys,
          >
          > This is a sample:
          >
          > "Everton 1 - 0 Portsmouth "
          > "Hull City 0 - 0 Liverpool "
          > "Man Utd 4 - 0 Stoke City "
          > "West Ham 1 - 1 Man City "
          > "Wolves 2 - 1 Sunderland"
          >
          > Taken from http://fantasy.premierleague.com/M/fixture.mc?event=38
          >
          > I need a regular expression (for GetDocMatchAll) to get the away team name into an array. In the above case it is, "Portsmouth, Liverpool, Stoke City, Man City, Sunderland".
          >
          > Anyone help ?
          >

          This should work on your sample:

          ^!SetListDelimiter ,\x20
          ^!SetArray %Away%=^$GetDocMatchAll(-\x20\d+\x20\K.+?(?=\x20?"\R))$
          ^!Set %Away%=^$StrDeleteRight("^%Away%";2)$
          ^!Prompt ^%Away%
        • diodeom
          ... Errata (if spaces I copied could be tabs and to catch the no-CR trailing at the end): ^$GetDocMatchAll(- h d+ h K.+?(?= h? ( R| Z)))$
          Message 4 of 9 , Jun 24, 2010
            I wrote:
            >
            > This should work on your sample:
            >

            Errata (if spaces I copied could be tabs and to catch the no-CR trailing at the end):

            ^$GetDocMatchAll(-\h\d+\h\K.+?(?=\h?"(\R|\Z)))$
          • dvdwriters12
            Hi Diodeom, I tried your example but it didnt find anything. They are tabs and spaces which the forum is not showing properly. The last one has no tab. To get
            Message 5 of 9 , Jun 24, 2010
              Hi Diodeom,

              I tried your example but it didnt find anything.

              They are tabs and spaces which the forum is not showing properly.
              The last one has no tab.

              To get the sample from the original source go to

              http://fantasy.premierleague.com/M/fixture.mc?event=38

              Copy and paste the results you see at the bottom into notetab.
              i.e.

              Arsenal 4 - 0 Fulham
              Aston Villa 0 - 1 Blackburn
              Bolton 2 - 1 Birmingham
              Burnley 4 - 2 Tottenham
              Chelsea 8 - 0 Wigan
              Everton 1 - 0 Portsmouth
              Hull City 0 - 0 Liverpool
              Man Utd 4 - 0 Stoke City
              West Ham 1 - 1 Man City
              Wolves 2 - 1 Sunderland


              --- In ntb-clips@yahoogroups.com, "diodeom" <diomir@...> wrote:
              >
              > I wrote:
              > >
              > > This should work on your sample:
              > >
              >
              > Errata (if spaces I copied could be tabs and to catch the no-CR trailing at the end):
              >
              > ^$GetDocMatchAll(-\h\d+\h\K.+?(?=\h?"(\R|\Z)))$
              >
            • diodeom
              ... That s quite different than the sample I played with... And what a mess when I copied it directly from the web! Chrome gave me multiple tabs and spaces,
              Message 6 of 9 , Jun 24, 2010
                "dvdwriters12" <dvdwriters@...> wrote:
                >
                > Hi Diodeom,
                >
                > I tried your example but it didnt find anything.
                >
                > They are tabs and spaces which the forum is not showing properly.
                > The last one has no tab.
                >
                > To get the sample from the original source go to
                >
                > http://fantasy.premierleague.com/M/fixture.mc?event=38
                >
                > Copy and paste the results you see at the bottom into notetab.
                > i.e.
                >
                > Arsenal 4 - 0 Fulham
                > Aston Villa 0 - 1 Blackburn
                > Bolton 2 - 1 Birmingham
                > Burnley 4 - 2 Tottenham
                > Chelsea 8 - 0 Wigan
                > Everton 1 - 0 Portsmouth
                > Hull City 0 - 0 Liverpool
                > Man Utd 4 - 0 Stoke City
                > West Ham 1 - 1 Man City
                > Wolves 2 - 1 Sunderland
                >
                >

                That's quite different than the sample I played with... And what a mess when I copied it directly from the web! Chrome gave me multiple tabs and spaces, including trailing ones. Here's what worked for me:

                ^$GetDocMatchAll(-\h+\d+\h+\K.+?(?=\h*(\R|\Z)))$
              • dvdwriters12
                Yeah it is messy when copied from the web. But thanks that worked a treat!! Do you mind giving me a quick break down on your regular expression. Some of those
                Message 7 of 9 , Jun 24, 2010
                  Yeah it is messy when copied from the web. But thanks that worked a treat!!

                  Do you mind giving me a quick break down on your regular expression. Some of those codes are new to me.

                  --- In ntb-clips@yahoogroups.com, "diodeom" <diomir@...> wrote:
                  >
                  > That's quite different than the sample I played with... And what a mess when I copied it directly from the web! Chrome gave me multiple tabs and spaces, including trailing ones. Here's what worked for me:
                  >
                  > ^$GetDocMatchAll(-\h+\d+\h+\K.+?(?=\h*(\R|\Z)))$
                  >
                • diodeom
                  My pleasure. ^$GetDocMatchAll(- h+ d+ h+ K.+?(?= h*( R| Z)))$ Locate: - (dash) h+ (followed by at least one horizontal space like t or x20, that is: tab or
                  Message 8 of 9 , Jun 24, 2010
                    My pleasure.

                    ^$GetDocMatchAll(-\h+\d+\h+\K.+?(?=\h*(\R|\Z)))$

                    Locate:
                    - (dash)
                    \h+ (followed by at least one horizontal space like \t or \x20, that is: tab or space)
                    \d+ (followed by at least one digit to accommodate indefinitely high-scoring games ;)
                    \h+ (followed by at least one horizontal space)
                    \K (don't capture what's been matched so far)
                    .+? (Proper capture: minimum number of any characters [except newlines] that fulfill the condition...)
                    (?= (...of preceding...)
                    \h* (...optionally any number of horizontal spaces)
                    (\R|\Z) (before either a newline sequence or the end of the doc/selection)
                    ) (closing paren of the positive look-ahead assertion (?=stuff))


                    --- In ntb-clips@yahoogroups.com, "dvdwriters12" <dvdwriters@...> wrote:
                    >
                    > Yeah it is messy when copied from the web. But thanks that worked a treat!!
                    >
                    > Do you mind giving me a quick break down on your regular expression. Some of those codes are new to me.
                    >
                    > --- In ntb-clips@yahoogroups.com, "diodeom" <diomir@> wrote:
                    > >
                    > > That's quite different than the sample I played with... And what a mess when I copied it directly from the web! Chrome gave me multiple tabs and spaces, including trailing ones. Here's what worked for me:
                    > >
                    > > ^$GetDocMatchAll(-\h+\d+\h+\K.+?(?=\h*(\R|\Z)))$
                    > >
                    >
                  • dvdwriters12
                    Thank you, much appreciated!!
                    Message 9 of 9 , Jun 24, 2010
                      Thank you, much appreciated!!

                      --- In ntb-clips@yahoogroups.com, "diodeom" <diomir@...> wrote:
                      >
                      > My pleasure.
                      >
                      > ^$GetDocMatchAll(-\h+\d+\h+\K.+?(?=\h*(\R|\Z)))$
                      >
                      > Locate:
                      > - (dash)
                      > \h+ (followed by at least one horizontal space like \t or \x20, that is: tab or space)
                      > \d+ (followed by at least one digit to accommodate indefinitely high-scoring games ;)
                      > \h+ (followed by at least one horizontal space)
                      > \K (don't capture what's been matched so far)
                      > .+? (Proper capture: minimum number of any characters [except newlines] that fulfill the condition...)
                      > (?= (...of preceding...)
                      > \h* (...optionally any number of horizontal spaces)
                      > (\R|\Z) (before either a newline sequence or the end of the doc/selection)
                      > ) (closing paren of the positive look-ahead assertion (?=stuff))
                      >
                      >
                    Your message has been successfully submitted and would be delivered to recipients shortly.