Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 421
  • Last Modified:

PREG Reg Expression to match token

Hello,
Im trying to write a PREG (php) based reg expression to replace any tokens embedded within a template to "". Unfortunately, I cant seem to figure out how to properly match the tokens.

The tokens are formatted as follows:

[@ operator @]

I need to be able to replace [@ * @] with just nothing.

I have tried /[\[@] + [@\]]/, and various variations with no luck. I suspect my problem is that Im unsure as how to force the literal on the [ ], as well as unsure how to match anything in the middle.

Thanks,
Rick
0
richardsimnett
Asked:
richardsimnett
1 Solution
 
Lukasz ChmielewskiCommented:
And the:
\[\@.*@\]
?
0
 
richardsimnettAuthor Commented:
Excellent. I didnt catch that I had to escape both the [ and the @. Thank you!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now