Win Question about conditional expression
#1
I want to prevent a regexp to run if a previous regexp in the flow was found.
these regexps are inside <GetDetails>...<GetDetails>
How can I do that?
Reply
#2
You can't stop a regexp from running, except by conditional from a boolean setting.

...BUT that doesn't prevent you from changing what it is the regexp searches.

Example:
PHP Code:
<RegExp input="$$3" output="\1" dest="8+">
  <
RegExp input="$$1" output="Buffer 1 contains foo" dest="3">
    <
expression clear="yes">foo</expression>
  </
RegExp>
  <
RegExp input="$$2" output="Buffer 1 contains bar, but not foo" dest="3">
    <
RegExp input="$$3" output="$$1" dest="2">
      <
expression clear="yes">^$</expression>
    </
RegExp>
    <
expression>bar</expression>
  </
RegExp>
  <
expression noclean="1"/>
</
RegExp

The key part is the innermost regexp, if $$3 is empty after the first regexp, then $$1 will be copied to $$2, otherwise $$2 will be cleared. The outer regexp then searches $$2 instead of $$1, and is guaranteed to fail if the earlier regexp succeeded (because $$2 will be empty).

Of course, if you're not bothered about outputting the earlier regexp, you can do it directly:
PHP Code:
<RegExp input="$$2" output="Buffer 1 contains bar, but not foo" dest="8+">
  <
RegExp input="$$1" output="$$1" dest="2">
    <
expression clear="yes">^(?!.*foo)</expression>
  </
RegExp>
  <
expression>bar</expression>
</
RegExp
(Obviously, you could achieve the above with a single regexp, it's just meant as an example).
Reply
#3
Thanks, it worked!
Reply

Logout Mark Read Team Forum Stats Members Help
Question about conditional expression0