Note that there are some explanatory texts on larger screens.

plurals
  1. PORegular expression extraction in text editors
    text
    copied!<p>I'm kind of new to programming, so forgive me if this is terribly obvious (which would be welcome news).</p> <p>I do a fair amount of PHP development in my free time using pregmatch and writing most of my expressions using the free (open source?) Regex Tester.</p> <p>However frequently I find myself wanting to simply quickly extract something and the only way I know to do it is to write my expression and then script it, which is probably laughable, but welcome to my reality. :-)</p> <p>What I'd like is something like a simple text editor that I can feed my expression to (given a file or a buffer full of pasted text) and have it parse the expression and return a document with only the results.</p> <p>What I find is usually regex search/replace functions, as in Notepad++ I can easily find (and replace) all instances using an expression, but I simply don't know how to only extract it...</p> <p>And it's probably terribly obvious, can expression match only the inverse? Then I could use something like (just the expression I'm currently working on):</p> <pre><code>&lt;a href="/browse/0/b/-dbm/a/0-0/1200000([^/]*)/0.html"&gt;([^&lt;]*)&lt;/a&gt; </code></pre> <p>And replace everything that <em>doesn't</em> match with nothing. But I'm sure this is something common and simple, I'd really appreciate any poniters.</p> <p>FWIW I know grep and I <em>could</em> do it using that, but I'm hoping their are better gui'ified solution I'm simply ignorant of.</p> <p>Thanks.</p> <p>Zach</p> <hr> <p>What I was hoping for would be something that worked in a more standard set of gui tools (ie, the tools I might already be using). I appreciate all the responses, but using perl or vi or grep is what I was hoping to avoid, otherwise I would have just scripted it myself (of course I did) since their all relatively powerful, low-level tools.</p> <p>Maybe I wasn't clear enough. As a senior systems administrator the cli tools are familiar to me, I'm quite fond of them. Working at home however I find most of my time is spent in a gui, like Netbeans or Notepad++. I just figure there would be a simple way to achieve the regex based data extraction using those tools (since in these cases I'd already be using them).</p> <p>Something vaguely like what I was referring to would be <a href="http://www.lfmseek.com/rss/extractor.php" rel="nofollow noreferrer">this</a> which will take aa expression on the first line and a url on the second line and then extract (return) the data.</p> <p>It's ugly (I'll take it down after tonight since it's probably riddled with problems).</p> <p>Anyway, thanks for your responses. I appreciate it.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload