Discussion Thread
Data Extractor
Message Thread
Extract any data, including email addresses and URLs from your files and webpages.
Posted in the Data Extractor Forum.
How to apply 'non-greedy' to Regular Expression?
I've created the following Pattern based Rule (no Match Case):
(href|src)="?.*\.(js|css)"?
The ? at the end is suppose to make the preceding quote non-greedy.
I then apply it to the following 4 lines of text:
<script type="text/javascript" src="repertoire/highslide-with-gallery.js"> </script>
<script type="text/javascript" src="repertoire/highslide.config.js" charset="utf-8"> </script>
<link rel="stylesheet" type="text/css" href="repertoire/highslide.css" />
<link rel="stylesheet" href="ccb-moz-php.css" type="text/css" />
with the following 1 line result:
src="repertoire/highslide-with-gallery.js"> </script>
<script type="text/javascript" src="repertoire/highslide.config.js" charset="utf-8"> </script>
<link rel="stylesheet" type="text/css" href="repertoire/highslide.css" />
<link rel="stylesheet" href="ccb-moz-php.css"
-----------------------------------------------------------------------
using the same input and rule at
Http://www.regexplib.com/RETester.aspx
results in:
src="repertoire/highslide-with-gallery.js"
src="repertoire/highslide.config.js"
href="repertoire/highslide.css"
href="ccb-moz-php.css"
Which is the desired result.
-----------------------------------------------------------------------
How do I change Data Extractor's Greedy search into a Non-Greedy search so I can get meaningful results.
Thanks,
Marc