Regex manual

dafi's profile image dafi posted 9 years ago in General Permalink
Is there a document that defines the regex facilities in Heidi? Hopefully there is something that gives a few examples.
jfalch's profile image jfalch posted 9 years ago Permalink
there generally are no documents around heidisql itself. however, which regex facilities do you mean ? RLIKE and such ?
dafi's profile image dafi posted 9 years ago Permalink
There are several different variations of regex. I would like a reference that says which characters need to be escaped and which ones don't. Also when using regex in the Heidi search and replace facility, what characters do I use to specify parts of the match string in the replace string?
for example, if I match 'XX[0-9]YY' and I want to replace it with 'ZZxPP' where x is the digit that matched the [0-9], what should the replace string look like? Some examples of regex I have seen use 'ZZ%1PP' but that doesn't work in Heidi.
kalvaro's profile image kalvaro posted 9 years ago Permalink

there generally are no documents around heidisql itself. however, which regex facilities do you mean ? RLIKE and such ?



HeidiSQL accepts regular expressions in places like the left pane's table filter and the query editor.

There are several different variations of regex. I would like a reference that says which characters need to be escaped and which ones don't.



In my experience, that's something that rarely changes between engines. Whatever, replacement expressions (your example) tend to change quite a log. HeidiSQL uses an editor component called SynEdit but it's hard to find documentation about its dialect.

Whatever, here's a little tip. If open the "Search and replace text" dialogue and you hover the "Regular expression" checkbox you get a little tooltip and it happens to answer your current question:

Text to find: XX([0-9])YY
Replace: ZZ$1PP
dafi's profile image dafi posted 9 years ago Permalink
Very good. I hadn't noticed the information hidden under the hover. I had tried $1 but I didn't know about the ().
Thanks for the tip.
kalvaro's profile image kalvaro posted 9 years ago Permalink
FYI, parenthesis are used to capture groups in all dialects I know.

Please login to leave a reply, or register at first.