ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Find And Run Robot

what is happening in this key sequence?

<< < (4/4)

mackal:
Ugh, fudging $$cc to accomodate a kludge... ugliness.  No, the original regex situation must be solved.  And I think it has been.  I gave it some more thought, and here is the proper solution, or at least on way to do it cleanly:

^tor(?:rent)? ((?:[^-]|-(?!-))*)(?:\s*--\s*(.*))?()



Yes, it's hairy, but does things properly.

Explanation:

^tor(?:rent)?
    Same as before.

((?:[^-]|-(?!-))*)
    Capture group $$1: capture as many characters as possible, as long as they are not a dash, or a dash followed by anything other than a second dash.  The outer "()" pair does the capturing/extraction.  The inner "(?: ...)" is there to limit extent of "|", without capturing.  The "(?!-)" is a negative look-ahead: matches when next character is not a dash, but does not consume it.

(?:\s*--\s*(.*))?
    Capture group $$2.  The outer "(?: ....)" groups the expression without capturing.  The trailing "?" makes the whole chunk optional.  The "\s*" are there to strip any white space, although the first instance is futile (the previous capture group will gobble up its trailing white space... regex parsing is greedy).  The inner "(.*)" is the part that actually does the capturing/extraction of $$2.

the trailing ()
    This again was needed, in the case where "--" is not given on the command line.  In such cases $$2 does not exist, hence the "$$2" in the "Result Filter for RegEx" field is being treated as a literal string, rather than a variable.  This causes 0 matching results, unless one of the result hits contains a literal (unsubstituted) "$$2" string.

So with this regex you can go back to using $$1 instead of $$1$$3.

Hope this helps.

nitrix-ud:
@mackal
thanks ! wonderful regex

@mouser,
i think mackal should be a contributor to the advanced FARR hacking guide :D

Navigation

[0] Message Index

[*] Previous page

Go to full version