Bug #12912 Unable to load completely a saved Regex query in RegEx text importer tool
Submitted: 31 Aug 2005 15:13 Modified: 12 Jan 2007 14:36
Reporter: Fred Testard Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Query Browser Severity:S4 (Feature request)
Version:1.1.14 OS:Windows (Win XP)
Assigned to: Mike Lischke CPU Architecture:Any
Tags: Generic

[31 Aug 2005 15:13] Fred Testard
Description:
When loading a previously saved regex query, the nested regex part (regular expression and associated insert statement are lost (though still are there in the .rex file).

The first level regex comes out OK.

The .rex file : 

<RegEx Name="RegEx1" TriggerInsertStatement="0" Parent=""  ParentMatch="0">
  <RegularExpression>&amp;lt;index&amp;gt;.*?&amp;lt;family&amp;gt;(.*?)&amp;lt;/family&amp;gt;.*?&amp;lt;indexname&amp;gt;(.*?)&amp;lt;/indexname&amp;gt;.*?&amp;lt;series&amp;gt;(.*?)&amp;lt;/series&amp;gt;.*?&amp;lt;version&amp;gt;(.*?)&amp;lt;/version&amp;gt;.*?&amp;lt;red&amp;gt;(.*?)&amp;lt;/red&amp;gt;.*?&amp;lt;component&amp;gt;(.*?)&amp;lt;/index&amp;gt;</RegularExpression>
  <InsertStatement>INSERT INTO redindice(family, name, series,  version, redindice,refentity, red, weight)
VALUES('$RegEx1.1', '$RegEx1.2','$RegEx1.3','$RegEx1.4','$RegEx1.5','','','');</InsertStatement>
  <RegEx Name="RegEx2" TriggerInsertStatement="1" Parent="RegEx1"  ParentMatch="6">
    <RegularExpression>&amp;lt;refentity&amp;gt;.*?&amp;lt;name&amp;gt;(.*?)&amp;lt;/name&amp;gt;.*?&amp;lt;red&amp;gt;(.*?)&amp;lt;/red&amp;gt;.*?&amp;lt;weight&amp;gt;(.*?)&amp;lt;/weight&amp;gt;.*?&amp;lt;/refentity&amp;gt;</RegularExpression>
    <InsertStatement>INSERT INTO redindice(family, name, series,  version, redindice,refentity, red, weight)
VALUES('$RegEx1.1', '$RegEx1.2','$RegEx1.3','$RegEx1.4','$RegEx1.5','$RegEx2.1','$RegEx2.2','$RegEx2.3');</InsertStatement>
  </RegEx>
</RegEx>

How to repeat:
- make a regex and a nested regex within the RegEx Text importer tool
- save
- load => nested regex is lost 

Suggested fix:
?
[31 Aug 2005 15:40] Jorge del Conde
Hi!

Can you please post your query so that we can test this out ?

Thanks!
[31 Aug 2005 16:36] Fred Testard
First level Regex : <index>.*?<family>(.*?)</family>.*?<indexname>(.*?)</indexname>.*?<series>(.*?)</series>.*?<version>(.*?)</version>.*?<red>(.*?)</red>.*?<component>(.*?)</index>

Associated insert Query : none (apparently if you leave this first level insert statement blank the tool makes the "store to SQL script" and "Execute" buttons gray / inactivated for the nested regex - another issue ? - i left a ";" for this to work)

Nested Regex :
<refentity>.*?<name>(.*?)</name>.*?<red>(.*?)</red>.*?<weight>(.*?)</weight>.*?</refentity>

Associated insert query :
INSERT INTO redindice(family, name, series,  version, redindice,refentity, red, weight)
VALUES('$RegEx1.1', '$RegEx1.2','$RegEx1.3','$RegEx1.4','$RegEx1.5','$RegEx2.1','$RegEx2.2','$RegEx2.3');

2 files attached : a sample XML file for the source text and the .rex file saved generated by the tool when saving (the one that cannot be reloaded)
[31 Aug 2005 16:46] Jorge del Conde
Thanks for your bug report.  I was able to reporduce this bug
[21 Sep 2006 10:20] Mark Eason
A work-around is to add a dummy nested expression at the end of the .rex file.
[13 Mar 2014 13:34] Omer Barnir
This bug is not scheduled to be fixed at this time.