I hope this is the best place to post this question. I need help with using wildcards in a regular expression. Using the below example line of code, how do I find cases of $code = 'XXXXXXXX' using a regular expression in source code; regardless of what is between the single quotes? I have many php files that I want to search and they all have that line of code except they differ in what is in the quotes. I want to find them all and insert something else there. $code = 'ajvfweibfiuwbviusbvsv'; Code (markup): Thanks for helping the newb
If I was searching through a bunch of files, in say Dreamweaver, I think it would be: $code = '(.*)'; I think that's it, but I'm not sure if the $ character would mess up the search or anything.
Yes, I use Dreamweaver. What if the code is also broken across multiple lines? i.e. $code = 'aflshglkjbgadg kasbfiujabfgoauwbgoawg nsdkjgbnaskj'; Code (markup):
Multiple lines is difficult for me to remember...I think to search for everything, even new lines, it's something like (\s|\S)* but I'm not sure how to translate that into what you need. I'm not a pro with reg expressions at all, but I hope that helps a little bit.
Thanks. Maybe I should have put this in the php programming category? Hopefully someone stumbles across this and can help. I've tried reading at least a dozen reg exp online tutorials and am lost. I'm certainly no programmer.
I don't use dreamweaver but I do know some REGEX in PHP and what webmaster_TSU gave you SHOULD work (in PHP, I'm pretty sure the . character matches even new lines, as it matches any charcter at all). However, you might have to escape the $ (by changing it to \$) because in other REGEX, $ means end of line.