anton zamov it expert logo   best php scripts for your website

home page latest news web development curriculum vitae scripts contact me


  • Curriculum Vitae (CV)
  • Major web solutions
  • Web design projects
  • Software solutions


  • C# (Microsoft .NET)
  • JAVA
  • Dynamic HTML
  • PHP & MySQL
  • ASP.NET - C# & VB.NET
  • Perl & CGI
  • C | C++
  • Vector Markup Language
  • SMIL
  • Assembler
  • Databases
  • Wap Development
  • Web site promotion
  • Web Marketing




Regular expressions, using wildcards?

(Perl free example written by Anton Zamov.)


Regular expressions, using wildcards?

. Match any character
w Match "word" character (alphanumeric plus "_")
W Match non-word character
s Match whitespace character
S Match non-whitespace character
d Match digit character
D Match non-digit character
t Match tab
n Match newline
r Match return
f Match formfeed
a Match alarm (bell, beep, etc)
e Match escape
021 Match octal char ( in this case 21 octal)
xf0 Match hex char ( in this case f0 hexidecimal)
You can follow any character, wildcard, or series of characters and/or wildcard with a repetiton. Here's where you start getting some power:
* Match 0 or more times
+ Match 1 or more times
? Match 1 or 0 times
{n} Match exactly n times
{n,} Match at least n times
{n,m} Match at least n but not more than m times
Now for some examples:
$string =~ m/s*rem/i; #true if the first printable text is rem or REM
$string =~ m/^S{1,8}.S{0,3}/; # check for DOS 8.3 filename
# (note a few illegals can sneak thru)


Still have questions? Ask your question on TechOnlineHelp.com or find more examples on www.netartmedia.net/examples




If this example was useful for you, please support my company and click Like on the button below. Thank you very much!



Jobs Portal, poweful jobs board software

PHP Mall, multi vendors mall website software

Car Portal, php script for auto classifieds websites

NetArt Media, software products and services

Real Estate Portal, web software for real estate portals

Blog System, multi user blog hosting script

PHP Store, powerful e-commerce system written in PHP

Pharmacy System, software for running online pharmacies

C# (Microsoft .NET) | JAVA | Dynamic HTML | PHP & MySQL | Perl & CGI | C | C++ | Vector Markup Language
SMIL | Assembler | Databases | Wap Development | Web site promotion | Web Marketing

Copyright Anton Zamov 1998-2012