heatblazer has asked for the wisdom of the Perl Monks concerning the following question:
Hello again, monks. This time I need some help about Regular Expressions. Lame of me, but I still can`t get the 'source' of it... I require a simple and small explanation about them with my few regex needs here is some:
Validate me a mail but it should be aware of:
*johnsmith@yahoo.com
hello12@.com
hello@gmail..com
etc.
Please, write me a good example with appropriate comments to see how these regexes are working since I just can`t get it.
Well, thanks for replying I am getting the hang of it reading some books, here is one of my tests about simple html tag checking:
#!/usr/bin/perl use warnings; use strict; while (<DATA>) { if ( /<hr( +size *=? *[0-9]+ *(\/>|>)| +\/>|>)/i ) { print; } } __DATA__ <hr size==12 /> <hr size = 12 />#!/usr/bin/perl use warnings; use strict; while (<DATA>) { if ( /<hr( +size *=? *[0-9]+ *(\/>|>)| +\/>|>)/i ) { print; } } __DATA__ <hr size==12 /> <hr size = 12 /> <hr size=14> <hr> <hr > <hr /> <hr size /> <hr size=14> <hr> <hr > <hr /> <hr size />
This is a fair good match I`ve made for horizontal lines tags with regexes :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: RegExp help
by dorko (Prior) on Mar 26, 2012 at 14:17 UTC | |
by heatblazer (Scribe) on Mar 26, 2012 at 15:45 UTC | |
|
Re: RegExp help
by stevieb (Canon) on Mar 26, 2012 at 14:32 UTC | |
by heatblazer (Scribe) on Mar 26, 2012 at 15:46 UTC | |
|
Re: RegExp help
by Anonymous Monk on Mar 26, 2012 at 14:15 UTC | |
|
Re: RegExp help
by JavaFan (Canon) on Mar 26, 2012 at 15:47 UTC | |
by heatblazer (Scribe) on Mar 27, 2012 at 03:42 UTC | |
by JavaFan (Canon) on Mar 27, 2012 at 09:06 UTC | |
by heatblazer (Scribe) on Mar 27, 2012 at 14:17 UTC | |
by JavaFan (Canon) on Mar 27, 2012 at 14:58 UTC | |
|