Anyone with Regex skill tell me how to use square braces in regex. I am using the following to find:
[code]#LINK[/LINK]#Usi
to find all text between [LINK] and [/LINK]
[/code]
Anyone with Regex skill tell me how to use square braces in regex. I am using the following to find:
[code]#LINK[/LINK]#Usi
to find all text between [LINK] and [/LINK]
[/code]
Escape the square brackets with \.
As i was asking this question I was hoping Kem was online. Always good for Regex help, thanks Kem. I tried that and now have the following which does not seem to be working either
#\\[LINK\\]([^\\[]*)\\[\\/LINK\\]#Usi
Can you post some sample text?
[code][LINK]http://www.example.com[/LINK]
What I used this for
The following code was used to start my apache server from Xojo. I suspect you could replace the ‘sudo apachectl start’ code with any other command which requires sudo to run.
[CE]
Dim sh as new Shell
sh.Execute “osascript -e ‘do shell script ““sudo apachectl start”” with administrator privileges’”
TextArea1.Text = TextArea1.Text + EndOfLine + sh.Result
[/CE][/code]
You’re not putting the “#” and “#Usi” into the pattern, are you?
Yes, got it working with:
#(?<=LINK\\])(.*?)(?=\\[/LINK)#Usi