As part of a project, I need to analyse string which may contain a reference to PHP in the following manner:
[php]functionName(args1, args2)[/php]
The function name is not always the same, and I would like to replace everything in the above example (including the pseudo-tags) with another value.
Can anyone suggest a Regular Expression to effectively match the pattern [php]anything[/php].
Sorry if this is a basic question, but I suck at Regular Expressions!
I think
"\[php\](.*?)\[\/php\]"would do the trick.Edit: you may or may not need the double quotes– not sure how you’re ultimately using the regex string.