[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: efficiently extracting a capture group from analy
Hi Gerrit, Graydon, Thanks for having a look! The tricky part is, I need an empty sequence if the input string does not comply with pattern. replace() returns the original string for a non-match. I could address that with a prefilter: replace($file[matches(., '/my-(\w+)\.xml$')], '^.+/my-(\w+)\.xml$', '$1') but I don't like duplicating patterns because they can accidentally become desynchronized. (If anyone suggests an ENTITY as a solution here, please see me after class.) Graydon, I need your solution for obtaining the file basename elsewhere in my stylesheet -- thank you!! -- but I run into the prefilter double-pattern issue whether I replace()the full path or just the basename. And although this example processes a filename, I'd like to find best generalized way to obtain a capture group (or nothing) for any match scenario. In perl, I can assign a variable to the result of a regex match: my $file = 'path/my-sometype.xml'; my ($type) = ($file =~ m{my-(\w+)}); and I was hoping for something similar in XQuery. Thank you everyone! It's nice to be able to group-think through this. - Chris XSL-List info and archive<https://urldefense.com/v3/__http:/www.mulberrytech.com/xsl/xsl-list__ ;!!A4F2R9G_pg!YXd556WaLkP4pGQ6edPoLq22GVZWXz0FWKC8B6fG3pWIEv49hMn2JEHevovei-D Y16w5mb_F-bFG4sPyBrcYYJwk3mBc3dJ69yblgscpjoSpFqlrlsgk$> EasyUnsubscribe<https://urldefense.com/v3/__http:/lists.mulberrytech.com/unsu b/xsl-list/3380743__;!!A4F2R9G_pg!YXd556WaLkP4pGQ6edPoLq22GVZWXz0FWKC8B6fG3pW IEv49hMn2JEHevovei-DY16w5mb_F-bFG4sPyBrcYYJwk3mBc3dJ69yblgscpjoSpFguJxHbP$> (by email<>)
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|