Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Re: Regex (lookahead) Confusion

by allolex (Curate)
on Feb 05, 2004 at 21:04 UTC ( [id://326880]=note: print w/replies, xml ) Need Help??


in reply to Re: Regex (lookahead) Confusion
in thread Regex (lookahead) Confusion

This is a really good effort, but it fails if characters not matching the given character set are included in the string.

Unfortunately, I don't have a solution, either because in my mind, there would have to be a lookbehind on a string of variable length, which (of course) will not work.

#!/usr/bin/perl use strict; use warnings; while(<DATA>) { chomp; if (! /([smtwhfa])(?=.*?\1)/) { print "$_ : OK\n"; } else { print "$_ : Not OK\n"; } } __DATA__ swma smqa smsa fhtm ttma t2ms __END__ swma : OK smqa : OK smsa : Not OK fhtm : OK ttma : Not OK t2ms : OK

--
Allolex

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://326880]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (7)
As of 2024-04-19 10:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found