Two regular expression questions

Discussion in 'Perl Misc' started by Dang Griffith, Feb 2, 2004.

  1. 1. Is there a more appropriate newsgroup to post questions regarding
    regular expressions? I know many languages now support them, but Perl
    is generally considered the de facto standard. (Yes?)

    2. Are there plans to add syntax to support matched-nesting, for
    things such as balanced parenthesis, angle-brackets, and quote marks?
    It's my understanding that there currently is not support for this,
    which is why you can't parse xhtml-like text with simply a regular
    expression. I.e., you need to go to the next level and write a parser
    to maintain the state of the nesting.

    Thanks,
    --dang
    Dang Griffith, Feb 2, 2004
    #1
    1. Advertising

  2. On Mon, 2 Feb 2004, Dang Griffith wrote:

    >1. Is there a more appropriate newsgroup to post questions regarding
    >regular expressions? I know many languages now support them, but Perl
    >is generally considered the de facto standard. (Yes?)


    This is the place to ask questions about Perl's regexes.

    >2. Are there plans to add syntax to support matched-nesting, for
    >things such as balanced parenthesis, angle-brackets, and quote marks?
    >It's my understanding that there currently is not support for this,
    >which is why you can't parse xhtml-like text with simply a regular
    >expression. I.e., you need to go to the next level and write a parser
    >to maintain the state of the nesting.


    You can match nested things with Perl's regexes, because Perl's regexes
    aren't... well... regular. You can execute arbitary code. You can
    dynamically generate the regex as it's being matched.

    --
    Jeff Pinyan RPI Acacia Brother #734 2003 Rush Chairman
    "And I vos head of Gestapo for ten | Michael Palin (as Heinrich Bimmler)
    years. Ah! Five years! Nein! No! | in: The North Minehead Bye-Election
    Oh. Was NOT head of Gestapo AT ALL!" | (Monty Python's Flying Circus)
    Jeff 'japhy' Pinyan, Feb 2, 2004
    #2
    1. Advertising

  3. In article <>,
    Dang Griffith <> wrote:
    :1. Is there a more appropriate newsgroup to post questions regarding
    :regular expressions? I know many languages now support them, but Perl
    :is generally considered the de facto standard. (Yes?)

    What perl supports are not really regular expressions; it supports
    a superset of regular expressions that can match things that
    regular expressions cannot. Thus, if you are trying to study
    true regular expressions, you might be better off looking elsewhere.


    :2. Are there plans to add syntax to support matched-nesting, for
    :things such as balanced parenthesis, angle-brackets, and quote marks?

    It isn't just a matter of syntax: it fundamentally affects the
    search strategy. True regular expressions *cannot* do balancing
    no matter what syntax you use.

    --
    Positrons can be described as electrons traveling backwards in time.
    Certainly many Usenet arguments about the past become clearer when they
    are re-interpreted as uncertainty about the future.
    -- Walter Roberson
    Walter Roberson, Feb 2, 2004
    #3
  4. On Mon, 2 Feb 2004 12:56:41 -0500, Jeff 'japhy' Pinyan
    <> wrote:

    >On Mon, 2 Feb 2004, Dang Griffith wrote:
    >
    >>1. Is there a more appropriate newsgroup to post questions regarding
    >>regular expressions? I know many languages now support them, but Perl
    >>is generally considered the de facto standard. (Yes?)

    >
    >This is the place to ask questions about Perl's regexes.
    >
    >>2. Are there plans to add syntax to support matched-nesting, for
    >>things such as balanced parenthesis, angle-brackets, and quote marks?
    >>It's my understanding that there currently is not support for this,
    >>which is why you can't parse xhtml-like text with simply a regular
    >>expression. I.e., you need to go to the next level and write a parser
    >>to maintain the state of the nesting.

    >
    >You can match nested things with Perl's regexes, because Perl's regexes
    >aren't... well... regular. You can execute arbitary code. You can
    >dynamically generate the regex as it's being matched.

    Thanks to Jeff and Walter. You both confirmed what I thought to be
    the case. I.e., regular expressions cannot support nested matching,
    but that additional programming can be created to support it.
    --dang rpi '87
    Dang Griffith, Feb 3, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. VSK
    Replies:
    2
    Views:
    2,268
  2. =?iso-8859-1?B?bW9vcJk=?=

    Matching abitrary expression in a regular expression

    =?iso-8859-1?B?bW9vcJk=?=, Dec 1, 2005, in forum: Java
    Replies:
    8
    Views:
    829
    Alan Moore
    Dec 2, 2005
  3. GIMME
    Replies:
    3
    Views:
    11,918
    vforvikash
    Dec 29, 2008
  4. Jeremy
    Replies:
    1
    Views:
    316
    Reinhold Birkenfeld
    Jul 11, 2005
  5. Ravi Singh
    Replies:
    9
    Views:
    122
    Ravi Singh
    May 5, 2007
Loading...

Share This Page