Anyway, are you sure you can't use "index()", "rindex()" and "substr()" instead of regexes? (I guess "length()" could be helpful, too.) E.g.:
Okay, it's a bit clumsy, and could be done more compactly, but it's one way of doing the job, if it's available to you.$bgn_target = "<!--begin node-->"; $bgn_offset = index( $_, $bgn_target ) + length( $bgn_target ); $keep_length = rindex( $_, "<!--end node-->" ) - $bgn_offset; $keep_string = substr( $_, $bgn_offset, $keep_length );
update: Looking at your post again, I figure the above suggestion is totally off the mark -- oh well.
Getting back to the regex... it may be that you don't need to worry at all about the stuff that precedes the first "begin node" signal -- just this much ought to match what you want to retain:
(that is, assuming that your regex engine -- whatever it is -- knows about using parens to capture part of a match)/<!--begin node-->(.*)<!--end node-->/
When you say you can't "supply any options", does this mean you can't use use the "s" qualifier on the match (so that "." matches new-lines as well as all other characters)? Or is this not an issue for you?
(The whole setup as you describe it seems kinda cryptic and warped, like your working inside a totalitarian regime...)
In reply to Re: Must use regex, how to clip...
by graff
in thread Must use regex, how to clip...
by chantstophacking
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |