Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: Help with Regex debugging.

  1. #1
    Join Date
    Jun 2009

    Default Help with Regex debugging.

    I'm having trouble getting what I need out of the Regex component.
    My regex is currently in use in a java program and works fine in regexbuddy, and other online regex verifiers. Is there some sort of quoting or something that I'm missing?

    Here's the regex, designed to extract a search query from a stored cookie that contains a request string:

    and here's an example of the cookie string (extracted from a database)


    the desired extraction is the string after q=, in the example it should be

    I've also extracted the data to a text file to insure there are no funky characterset issues. I'm using capture groups, and I only have one group.
    I've attached a sample transformation that takes a csv of sample data, and transforms and outputs to excel.
    Attached Files Attached Files
    Last edited by osbock; 06-19-2009 at 03:57 PM. Reason: Forgot to attach the datafile

  2. #2
    Join Date
    Jun 2009


    OK, I figured it out, and this really should be documented.
    The Capture groups are not processed unless the entire string matches the regular expression. In the original, it was sufficient to search to the first postion of interest, and match up to the part you wanted, and extract the backreference

  3. #3
    Join Date
    Sep 2009

    Default Backreference syntax

    I am trying to use a backreference in a "Replace in String" step. I have a zip code formatted like this:

    I am using this match:

    and am trying to use this replace with backreference:

    But the result that I get is the literal string "1-2".

    I also tried \\1-\\2, which gave me the same result.

    Is this possible in a "Replace in String" step? Am I doing it wrong?


  4. #4
    Join Date
    Jul 2009


    I still got the same problem, seing only 1 or \1 if I put \1 or \\1 in the Replace With column of Replace In String
    My regexp is trying to get only the section between the < > pair from the text :
    ex: blahblah <myText>
    I used the following Regexp

    and try to get \1 from this, but so far in vain

    Any help is appreciated

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.