[Slightly OT] Case against ".*" regexp

E

Edgardo Hames

Some time ago I remember reading a post in this list against using
".*" regexp but I cannot find it -- I guess I don't remember the right
keywords :(
Does anyone remember that?

Thanks a lot,
Ed
--=20
Encontr=E1 a "Tu psic=F3pata favorito" http://tuxmaniac.blogspot.com

The future is not what it used to be.
-- Paul Val=E9ry
 
R

Robert Klemme

Some time ago I remember reading a post in this list against using
".*" regexp but I cannot find it -- I guess I don't remember the right
keywords :(
Does anyone remember that?

Not exactly. But you should not use ".*" nested in another starred
expression because that will usually lead to massive backtracking.
Another problem is, that ".*" matches the empty string which is often
not what you want.

Kind regards

robert
 
B

Brian Candler

Not exactly. But you should not use ".*" nested in another starred
expression because that will usually lead to massive backtracking.
Another problem is, that ".*" matches the empty string which is often
not what you want.

And also eats as much string as it can without causing the regexp to fail -
*? is the non-greedy form.
 

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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top