in reply to Re^2: Looking for a Regex
in thread Looking for a Regex
... so as to force the OP to show effort.
And if you'd kept that to yourself, we might have found out if the OP had tried it.
With following the error messages and just a little effort, what I posted can become:
#! perl -slw use strict; for( qw[ ab123 'ab123s 'ab123's ] ) { if( m[ ^'? [a-z] ## start with letter or an apostro +phy followed by one [a-z0-9'-_]+ ## Alphanumeric + '-_ (?: [a-z0-9] | s') $ ## ends with alphanumeric or s' ]x and not m[''|--] ## No doubled ''s or --s ){ print "$_: Ok!"; } else { print "$_: Bad!"; } } __END__ C:\test>junk ab123: Ok! 'ab123s: Ok! 'ab123's: Ok!
Which gives a starting point but not the whole thing.
If you're going to bother saying something, best make it something useful.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Looking for a Regex
by 1nickt (Canon) on Mar 04, 2019 at 12:18 UTC | |
by BrowserUk (Patriarch) on Mar 04, 2019 at 13:22 UTC | |
by 1nickt (Canon) on Mar 04, 2019 at 14:45 UTC | |
by BrowserUk (Patriarch) on Mar 04, 2019 at 15:29 UTC |