Regular expression question

General discussions related to php

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 3
Joined: Sun Aug 31, 2003 2:32 am

Regular expression question

Postby CorellonElven » Sun Sep 28, 2003 3:39 am


I know this is a bit of topic but its still somewhat php related.

I am having difficulties with building the correct regular expression against which I test the input string with eregi function I need to check if the string i receive consists only of allowed characters and the square brackets [ ] something like that "^[0-9=+-]+$") plus those square brackets.
As far as I know I need to make this expression like this
"^[0-9=\[\]+-]+$") so I check if the string consists of one or more allowed characters.

This part of the expression is wrong \[\] (square brackets within square brackets)

What is the correct regular expression to match this pattern.

Thanks a lot.

User avatar
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

Postby Redcircle » Sun Sep 28, 2003 10:46 pm

I would suggest preg..

reg expressions are not my forte but the docs in the preg fucntions are very helpful when I need to use one.

Return to “PHP General”

Who is online

Users browsing this forum: Baidu [Spider] and 5 guests