Jump to content
xisto Community
Sign in to follow this  
CarlowOlson

Regular Expression

Recommended Posts

Hello Friends,

 

In programming, a regular expression is an expression that explains a pattern for a string. A string matches a regular expression if that string follows the pattern of that regular expression.

 

For example, you may want to create an account system, allowing username to only have uppercase and lowercase letters, and numbers. While a user is registering, you can check their desired username against a regular expression involving only alphanumeric characters. If it matches, then the username is valid to your requests. If it does not, the user has put in a character that does not follow the pattern of the regular expression.

 

In regular expressions, you can match certain characters, match a certain quantity of characters, match the casing of characters, and plenty more.

 

The syntax of a regular expression varies throughout every programming language, but Perl is often used due to its wide variety of options. Perl is also incorporated into many web languages, such as PHP, making regular expressions less of a hassle.

 

This is an example of a Perl regular expression, allowing a string with only alphanumeric characters, and an infinite length.

 

Thanks and Regards

Carlow Olson

Share this post


Link to post
Share on other sites

Hey, thanks for explaining what the regular expressions are. But I think it'd be more helpful to give a small tutorial/explanation on how to actually use them. For example, I know what they are but have no idea how to create them on my own.

Share this post


Link to post
Share on other sites

I am also interested in getting more info on this. I have done a fair amount of php programming for various websites of my own as well as some for friends. When trying to learn how to use the the preg_match functionality in php though I always run into problems and have had to outsource that portion of the code to others.If this is a topic you are knowledgeable about, please write a tutorial for us. I would love to finally get my head wrapped around this stuff so I can write better code.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.