Are Regular Expressions only for Robots and Einsteins? - I saw this code on Xippets:
(?Usi-m)\\[(\\w+)\\](.*)\\[/\\1\\]
Are Regular Expressions only for Robots and Einsteins? - I saw this code on Xippets:
(?Usi-m)\\[(\\w+)\\](.*)\\[/\\1\\]
Nope. Anyone can learn about it: http://www.regular-expressions.info/refquick.html
Anyone except me obviously
I join you. I use a lot of regular expressions in my usual work in InDesign, but each time I build a new one I have to look up every single term again. Similar things happened when I tried to learn C but didnÂ’t have the time to spend some time on it each day.
Correction. … robots, Einsteins, and Kem
@Kem Tekinay
~like anything else, regex takes a bit to learn. Kem has a great regex tool available at his site… Take a look.
I thought Kem was a Robot???
Don’t feel bad… I too cannot wrap my brain around anything beyond super simple expressions of this type
Thank goodness for people like Kem.
He shows the way with RegEx that us mere mortals cannot grasp.
This is what this forum is all about.
That does not compute…
I do appreciate all the kind words.
That pattern, BTW, is simply to find stuff between tags that use square brackets. So, for example, if you have text like “[tag]some text[/tag]” and wanted to get both the tag that was used and the text between them, you’d use that pattern:
(?Usi-m)# some switches that override any RegEx.Option settings
\\[ # Start with the opening square bracket
(\\w+) # A series of word characters (this is the tag) (Subgroup 1)
\\] # Closing square bracket
(.*) # The text between the tags (Subgroup 2)
\\[ # Next opening square bracket
/ # Forward slash
\\1 # The same text that was in subgroup 1; in other words, the closing tag
\\] # Closing square bracket
That looks a little nicer in RegExRX and is easier to make out.
HTH.
@Richard Summers if you are still looking at Regex, I am the same, I also believe it is only Kem who finds Regex natural. However, I understand Kem’s tool RegExRX comes highly recommended, I have also been using http://regex101.com which gives a great explanation on the right hand side of what your expression is doing. It will also count the number of iterations your expression takes and also convert it into PHP, Java etc etc. Well worth looking at and I find it is helping me learn hands on.
Cheers matey.
I have no idea what gave you that idea.
01001001 00100000 01101000 01100001 01110100 01100101 00100000 01110010 01100101 01100111 01100101 01111000 00100000 00111010 00101000
01000101 01110110 01100101 01110010 01111001 01101111 01101110 01100101 00100000 01100110 01100101 01100101 01101100 01110011 00100000 01110100 01101000 01100001 01110100 00100000 01110111 01100001 01111001 00100000 01100001 01110100 00100000 01100110 01101001 01110010 01110011 01110100 00101110
I understand RegEx as I am a long time “perl guy” doing lots of regex. Now I am no where near where Kem’s level. And RegExEx does help a lot in working out the regex. It will also generate the related Xojo code based on the regex you write in it.
One of the worst ever bugs I had was in 2011 with a regex. Along came Lion and my app only crashed. Realbasic didn’t like my regex in a thread because I had added some brackets for better reading the regex.