regex

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • chris

    regex

    i can see the power of regular expressions but am having a bit of a battle
    getting my head around them.

    can anyone recommend some BASIC - tutorials for using regex

    something like th idots guide :)
    or even total idiots guide :)

    somewhere that has some simple examples would be good toooo

    any help would be fantastic

    Chris


  • chris

    #2
    Re: regex

    i just had a thought

    is there any program that will create a regex
    for example you select the criteria and it generate an appropriate regex



    "chris" <someone@here.c om> wrote in message
    news:41bc0ec4$1 @funnel.arach.n et.au...[color=blue]
    >i can see the power of regular expressions but am having a bit of a battle
    >getting my head around them.
    >
    > can anyone recommend some BASIC - tutorials for using regex
    >
    > something like th idots guide :)
    > or even total idiots guide :)
    >
    > somewhere that has some simple examples would be good toooo
    >
    > any help would be fantastic
    >
    > Chris
    >[/color]


    Comment

    • d

      #3
      Re: regex

      I'm sure there is, but whether you'd want to use one is a different matter.
      Have you considered just messing around with regex after reading a tutorial?
      Everyone I know who uses regex learned that way - if you become reliant on
      software to write your code, you can find yourself in sticky situations ;)

      d

      "chris" <someone@here.c om> wrote in message
      news:41bc0ff7$1 @funnel.arach.n et.au...[color=blue]
      >i just had a thought
      >
      > is there any program that will create a regex
      > for example you select the criteria and it generate an appropriate regex
      >
      >
      >
      > "chris" <someone@here.c om> wrote in message
      > news:41bc0ec4$1 @funnel.arach.n et.au...[color=green]
      >>i can see the power of regular expressions but am having a bit of a battle
      >>getting my head around them.
      >>
      >> can anyone recommend some BASIC - tutorials for using regex
      >>
      >> something like th idots guide :)
      >> or even total idiots guide :)
      >>
      >> somewhere that has some simple examples would be good toooo
      >>
      >> any help would be fantastic
      >>
      >> Chris
      >>[/color]
      >
      >[/color]


      Comment

      • chris

        #4
        Re: regex

        i understand what u are saying and i agree - i would find it handy to be
        able to create the regex BUt i would also work out how it does it and
        eventually not use it

        i have played arount with it but am still not quite understanding it - a
        heap od examples would be great

        like in one site i saw this and i thought it was good

        / # identify URLs within a text file
        [^="] # do not match URLs in IMG tags like:
        # <img src="http://mysite.com/mypic.png">
        http|ftp|gopher # make sure we find a resource type
        :\/\/ # ...needs to be followed by colon-slash-slash
        [^ \n\r]+ # some stuff than space, newline, tab is in URL
        (?=[\s\.,]) # assert: followed by whitespace/period/comma
        /

        More examples like thaT WOULD BE GOOD
        "d" <d@example.co m> wrote in message
        news:niVud.1251 9$qr4.6085@fe2. news.blueyonder .co.uk...[color=blue]
        > I'm sure there is, but whether you'd want to use one is a different
        > matter. Have you considered just messing around with regex after reading a
        > tutorial? Everyone I know who uses regex learned that way - if you become
        > reliant on software to write your code, you can find yourself in sticky
        > situations ;)
        >
        > d
        >
        > "chris" <someone@here.c om> wrote in message
        > news:41bc0ff7$1 @funnel.arach.n et.au...[color=green]
        >>i just had a thought
        >>
        >> is there any program that will create a regex
        >> for example you select the criteria and it generate an appropriate regex
        >>
        >>
        >>
        >> "chris" <someone@here.c om> wrote in message
        >> news:41bc0ec4$1 @funnel.arach.n et.au...[color=darkred]
        >>>i can see the power of regular expressions but am having a bit of a
        >>>battle getting my head around them.
        >>>
        >>> can anyone recommend some BASIC - tutorials for using regex
        >>>
        >>> something like th idots guide :)
        >>> or even total idiots guide :)
        >>>
        >>> somewhere that has some simple examples would be good toooo
        >>>
        >>> any help would be fantastic
        >>>
        >>> Chris
        >>>[/color]
        >>
        >>[/color]
        >
        >[/color]


        Comment

        • Pedro Graca

          #5
          Re: regex

          ["Followup-To:" header set to comp.lang.php.]
          chris wrote:[color=blue]
          > i can see the power of regular expressions but am having a bit of a battle
          > getting my head around them.[/color]

          Try "regex-coach"

          [color=blue]
          > can anyone recommend some BASIC - tutorials for using regex[/color]

          The first Google hit for "regular expression tutorial" (no quotes) was
          This tutorial teaches you how to create your own regular expressions, starting with the most basic regex concepts and ending with the most advanced and specialized capabilities.


          --
          Mail to my "From:" address is readable by all at http://www.dodgeit.com/
          == ** ## !! ------------------------------------------------ !! ## ** ==
          TEXT-ONLY mail to the whole "Reply-To:" address ("My Name" <my@address>)
          may bypass my spam filter. If it does, I may reply from another address!

          Comment

          • d

            #6
            Re: regex

            Have you checked out PHP's manual? It has extensive documentation of PHP's
            regex support. Once you're familiar with the terminology, it has everything
            you need to know.

            I checked out google for some more sites, and this one came up:

            At Regular-Expressions.info you will find a wide range of in-depth information about a powerful search pattern language called regular expressions.


            Let me know if it's not good ;)

            "chris" <someone@here.c om> wrote in message
            news:41bc2f0b$1 @funnel.arach.n et.au...[color=blue]
            >i understand what u are saying and i agree - i would find it handy to be
            >able to create the regex BUt i would also work out how it does it and
            >eventually not use it
            >
            > i have played arount with it but am still not quite understanding it - a
            > heap od examples would be great
            >
            > like in one site i saw this and i thought it was good
            >
            > / # identify URLs within a text file
            > [^="] # do not match URLs in IMG tags like:
            > # <img src="http://mysite.com/mypic.png">
            > http|ftp|gopher # make sure we find a resource type
            > :\/\/ # ...needs to be followed by colon-slash-slash
            > [^ \n\r]+ # some stuff than space, newline, tab is in URL
            > (?=[\s\.,]) # assert: followed by whitespace/period/comma
            > /
            >
            > More examples like thaT WOULD BE GOOD
            > "d" <d@example.co m> wrote in message
            > news:niVud.1251 9$qr4.6085@fe2. news.blueyonder .co.uk...[color=green]
            >> I'm sure there is, but whether you'd want to use one is a different
            >> matter. Have you considered just messing around with regex after reading
            >> a tutorial? Everyone I know who uses regex learned that way - if you
            >> become reliant on software to write your code, you can find yourself in
            >> sticky situations ;)
            >>
            >> d
            >>
            >> "chris" <someone@here.c om> wrote in message
            >> news:41bc0ff7$1 @funnel.arach.n et.au...[color=darkred]
            >>>i just had a thought
            >>>
            >>> is there any program that will create a regex
            >>> for example you select the criteria and it generate an appropriate regex
            >>>
            >>>
            >>>
            >>> "chris" <someone@here.c om> wrote in message
            >>> news:41bc0ec4$1 @funnel.arach.n et.au...
            >>>>i can see the power of regular expressions but am having a bit of a
            >>>>battle getting my head around them.
            >>>>
            >>>> can anyone recommend some BASIC - tutorials for using regex
            >>>>
            >>>> something like th idots guide :)
            >>>> or even total idiots guide :)
            >>>>
            >>>> somewhere that has some simple examples would be good toooo
            >>>>
            >>>> any help would be fantastic
            >>>>
            >>>> Chris
            >>>>
            >>>
            >>>[/color]
            >>
            >>[/color]
            >
            >[/color]


            Comment

            • Tim Van Wassenhove

              #7
              Re: regex

              In article <slrncrof11.ln2 .hexkid@ID-203069.user.uni-berlin.de>, Pedro Graca wrote:[color=blue]
              > ["Followup-To:" header set to comp.lang.php.]
              > chris wrote:[color=green]
              >> i can see the power of regular expressions but am having a bit of a battle
              >> getting my head around them.[/color]
              >
              > Try "regex-coach"
              > http://www.weitz.de/regex-coach/
              >[color=green]
              >> can anyone recommend some BASIC - tutorials for using regex[/color]
              >
              > The first Google hit for "regular expression tutorial" (no quotes) was
              > http://www.regular-expressions.info/tutorial.html[/color]

              to complement the other urls





              --
              Met vriendelijke groeten,
              Tim Van Wassenhove <http://www.timvw.info>

              Comment

              • Harrie Verveer

                #8
                Re: regex

                I had exactly the same a few weeks ago =D

                luckily I had lessons 'regular expressions' at my school a while ago
                (eregi-style) of which i was very thankfull when I found out the power
                of regex in php.

                just start with some simple regular expressions, like converting \n to
                <BR> (yes i know there is nl2br, but just as a practice). Then try to
                strip all HTML tags out of a string. etc etc. start simple and make it
                yourself more difficult every time.

                If you really want to master regex en become a regex guru, I'd advise to
                buy yourself a book on regular expressions.

                Good luck with regex (they are fun to do =D)

                I know you can do it tiger!

                harrie

                chris wrote:[color=blue]
                > i can see the power of regular expressions but am having a bit of a battle
                > getting my head around them.
                >
                > can anyone recommend some BASIC - tutorials for using regex
                >
                > something like th idots guide :)
                > or even total idiots guide :)
                >
                > somewhere that has some simple examples would be good toooo
                >
                > any help would be fantastic
                >
                > Chris
                >
                >[/color]

                Comment

                • Ged Robinson

                  #9
                  Re: regex


                  "chris" <someone@here.c om> wrote in message
                  news:41bc0ff7$1 @funnel.arach.n et.au...[color=blue]
                  > i just had a thought
                  >
                  > is there any program that will create a regex
                  > for example you select the criteria and it generate an appropriate regex
                  >
                  >
                  >
                  > "chris" <someone@here.c om> wrote in message
                  > news:41bc0ec4$1 @funnel.arach.n et.au...[color=green]
                  > >i can see the power of regular expressions but am having a bit of a[/color][/color]
                  battle[color=blue][color=green]
                  > >getting my head around them.
                  > >
                  > > can anyone recommend some BASIC - tutorials for using regex
                  > >
                  > > something like th idots guide :)
                  > > or even total idiots guide :)
                  > >
                  > > somewhere that has some simple examples would be good toooo
                  > >
                  > > any help would be fantastic
                  > >
                  > > Chris
                  > >[/color]
                  >
                  >[/color]


                  Comment

                  • Ged Robinson

                    #10
                    Re: regex

                    Chris,

                    www.regexbuddy.com has just what you're looking for.

                    I learned to compose regex's the "manual" way - which I agree is the best,
                    nevertheless, this tool still comes in handy sometimes.

                    Ged

                    "chris" <someone@here.c om> wrote in message
                    news:41bc0ff7$1 @funnel.arach.n et.au...[color=blue]
                    > i just had a thought
                    >
                    > is there any program that will create a regex
                    > for example you select the criteria and it generate an appropriate regex
                    >
                    >
                    >
                    > "chris" <someone@here.c om> wrote in message
                    > news:41bc0ec4$1 @funnel.arach.n et.au...[color=green]
                    > >i can see the power of regular expressions but am having a bit of a[/color][/color]
                    battle[color=blue][color=green]
                    > >getting my head around them.
                    > >
                    > > can anyone recommend some BASIC - tutorials for using regex
                    > >
                    > > something like th idots guide :)
                    > > or even total idiots guide :)
                    > >
                    > > somewhere that has some simple examples would be good toooo
                    > >
                    > > any help would be fantastic
                    > >
                    > > Chris
                    > >[/color]
                    >
                    >[/color]


                    Comment

                    • Good Man

                      #11
                      Re: regex

                      "chris" <someone@here.c om> wrote in news:41bc0ec4$1 @funnel.arach.n et.au:
                      [color=blue]
                      > i can see the power of regular expressions but am having a bit of a
                      > battle getting my head around them.
                      >
                      > can anyone recommend some BASIC - tutorials for using regex[/color]


                      Comment

                      • drwxr-xr-x

                        #12
                        Re: regex

                        On Tue, 14 Dec 2004 09:32:07 -0600, Good Man hath writ:[color=blue]
                        > "chris" <someone@here.c om> wrote in news:41bc0ec4$1 @funnel.arach.n et.au:
                        >[color=green]
                        >> i can see the power of regular expressions but am having a bit of a
                        >> battle getting my head around them.
                        >>
                        >> can anyone recommend some BASIC - tutorials for using regex[/color]
                        >
                        > http://dinki.mine.nu/word/regex/regex.php[/color]

                        ....best viewed in lynx.

                        Comment

                        • Yevgen Varavva

                          #13
                          Re: regex




                          Comment

                          Working...