PHP program question -- ereg

Vicken

Senior member
Oct 10, 1999
381
0
0
I am trying to filter out words out a block of text. I decided to use the Ereg function. I am having problems figuring out how to use ereg properly.

I want to match this expression. The expression is enclosed with [ and ].

[## WORD]

Example:

[34 Hello]

I am also trying to filter out words enclosed in ( and ) at the same time.

 

kt

Diamond Member
Apr 1, 2000
6,032
1,348
136
try this:

ereg ("^.{1}\[\]{1}$|^.{1}\(\){1}$", $yourtext)

been a while, but what the above "should" do is find a string where it starts with [ or ( and end with ] or ).