Two regular expression questions

D

Dang Griffith

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
 
J

Jeff 'japhy' Pinyan

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.
 
W

Walter Roberson

: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.
 
D

Dang Griffith

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


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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top