Beginner PHP help needed

I have been learning PHP for some time now and I wanted one clarification.

I have seen the preg_match function called with different delimiting symbols like:




Today I also saw % being used.

My question is two part:

What all characters can be used?

And is there a standard ?



  • non-alphanumeric
  • non-whitespace and
  • non-backslash ASCII character

can be used as delimiter.

Also if you using the opening punctuation symbols as opening delimiter:

( { [ <

then their corresponding closing punctuation symbols must be used as closing delimiter:

) } ] >

The most common delimiter is /.But sometimes it's advised to use a different delimiter if a / is part of the regex.


// check if a string is number/number format:
if(preg_match(/^\d+\/\d+$/)) {
  // match

Since the regex contains the delimiter, you must escape the delimiter found in the regex.

To avoid the escaping it is better to choose a different delimiter, one which is not present in the regex, that way your regex will be shorter and cleaner:


Need Your Help

Dragging a tableview cell that contains uibuttons

objective-c uitableview uibutton touchesmoved

I'm trying to implement a uitableview that its rows can be dragged to right and left (and show something behind them).

Parsing a Directory of files - Check for a String

java parsing search data-structures

This is my first post here so kindly pardon any mistakes that I have. I'm still learning to find my way around Stack Exchange.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.