Regular Expression Required for Checksum variable

I am wanting to create a regular expression that extracts a variable checksum value (cs=) which is unique to a given server response string.
The issue I am having is that a simple regex being name="cs" value="(.+?)" just does not work because there are 18 different checksum values being returned per session id/server response.
So a simple regex just picks up any "cs" value and I guess gets confused since there are 18 different ones contained within the server response (all user related)
What i need is a regex to use say this value from the server response (JONHONEYMAN%40YAHOO.COM) or any other unique value which is contained within the string response from the server then extract the cs (Checksum) value from that string and make it variable :)
Here is the server response string:-
"fp=220:1200:2977638312763704:: NO::P1200_EMAIL_ADDRESS,P1200_ORGANISATION_NAME,P1200_UCRN,P1200_ORG_ID,P1200_CALLING_PAGE:JONHONEYMAN%40YAHOO.COM%2C john%20Honeyman%2C260%2C220%2C1190&cs=336788D01EC6E80B1877B3EE982E8B2D8" >Select</td></tr
can anyone help?
Thanks

You need an XML Parser.

Similar Messages

  • Regular Expression Search for Case Statement in VBA

    Hi,
    I'm having trouble trying to use regular expressions in a case statement. I have a CSV spreadsheet of a server's netstat output and am trying to plot everything into Visio. I have been able to do that, however I'm not trying to expand this capability and
    resuse the same code for many different servers. 
    I have the mainServer variable set as a Variant and in my current example it is set as "INTPXY001" (internal proxy server 001). I have tried different regex statements for the potential to have INTPXY001 - INTPXY999, EXTPXY001 - EXTPXY999, and
    SVCPXY001 - SVCPXY999 in place of the Case "INTPXY001", but nothing I have tried seems to work.
    '========================================
    Set mainServer As Variant
    Set AppVisio = CreateObject("visio.application")
    AppVisio.Visible = True
    AppVisio.Documents.AddEx "", visMSDefault, 0
    AppVisio.Documents.OpenEx "server_u.vss", visOpenRO + visOpenDocked
    mainServer = ActiveSheet.Cells(1, 2) 'sets mainServer to INTPXY001
    With AppVisio.ActiveWindow.Page
    Select Case mainServer
    Case "INTPXY001"
    .Drop AppVisio.Documents.Item("SERVER_U.VSS").Masters.ItemU("Proxy server"), 2.25, 9.25
    Case Else
    .Drop AppVisio.Documents.Item("SERVER_U.VSS").Masters.Item(("Server"), 2.25, 9.25
    End Select
    End With
    '========================================

    You cannot declare variables As Variant in VBScript. All variables in VBScript are implicitly variants.
    If you are asking about VBA (Visual Basic for Applications), then you're not asking in the correct forum.
    -- Bill Stewart [Bill_Stewart]

  • Indexing on regular expression seach for dynamic pattern

    Hello All,
    Would it be possible to create any index for regular expression search (REGEXP_LIKE) for 'dynamic' pattern?
    If the pattern is static, then we can create FBI, but is there any way for dynamic patterns? Please advise.
    Regards,
    Hari

    Thanks Dom, I have never used Oracle Text. Would it be possible to provide some sample code for above requirement.
    Regards,
    Hari

  • Regular expression: check for the presence of special characters.

    I have the following requirement:
    I need to check for the presence of the following characters in a keyword: @, #, > if any of these characters are present, then they need to be stripped off, before going further. Please let me know the regular expression to check for these characters.

    I am trying to extend the same logic for the following characters:
    .,‘“?!@#%^&*()-~<>[]{}\+=`©® . here is the code fragment:
    Pattern kValidator = Pattern.compile("[\\.,\\‘\\“?!@#%^&*()-~<>[]{}\\+=\\`©®]");
    Matcher kMatcher = kValidator.matcher(keyWord);
    if (kMatcher.find(0)) {
    keyWord = keyWord.replaceAll("[.,\\‘\\“?!@#%^&*()-~<>[]{}\\+=\\`©®]", " ");
    }I get the following error. This error is from the weblogic command window. I dont understand these special characters.
    Error:
    28 Oct 2008 12:27:48 | INFO  | SearchController   | Exception while fetching search results in controller:Unclosed character class near index
    39
    [\.,\&#915;Çÿ\&#915;Ç£?!@#%^&*()-~<>[]{}\+=\`&#9516;&#8976;&#9516;«]
                                           ^
    java.util.regex.PatternSyntaxException: Unclosed character class near index 39
    [\.,\&#915;Çÿ\&#915;Ç£?!@#%^&*()-~<>[]{}\+=\`&#9516;&#8976;&#9516;«]
                                           ^
            at java.util.regex.Pattern.error(Pattern.java:1650)
            at java.util.regex.Pattern.clazz(Pattern.java:2199)
            at java.util.regex.Pattern.sequence(Pattern.java:1727)
            at java.util.regex.Pattern.expr(Pattern.java:1687)
            at java.util.regex.Pattern.compile(Pattern.java:1397)
            at java.util.regex.Pattern.<init>(Pattern.java:1124)
            at java.util.regex.Pattern.compile(Pattern.java:817)

  • WebTest - VS2013 - Extract Regular Expression - Required=False

    I have an "Extract Regular Expression" that may or may not be able to extract a value. I set the property value of Required to False. The next block checks for the existence of that Context Parameter. If the Context Parameter is there, it does
    some work, if the Context Parameter is not there, it skips the condition.
    When I run my WebTest, it tells me that it passes the extraction rule but it never created the Context Parameter so the condition is skipped.
    If I set Required=True, everything works as expected.
    I remembered that there was a defect in VS2010 with the Required=False, so I added this Extraction Plug-In 
    [DisplayName("Extract Regular Expression Not Required")]
    [Description("Extract text matching a regex and add it to the test context. If no match is found, do not fail webtest. This gets around a VSTS bug where 'Required' property of the Extract Regular Expression rule is not honored.")]
    public class ExtractRegularExpressionNotRequired : ExtractRegularExpression
    public override void Extract(object sender, ExtractionEventArgs e)
    base.Extract(sender, e);
    e.Success = true;
    That too passes the regular expression but fails to create the Context Parameter.

    By setting the Required parameter to False, I am expecting that a Context Parameter does not get created if the regular expression is not found and that is does get created if the regular expression is found.
    So when I run my test, it tells me that the regular expression was found but my Context Parameter was not created. 
    When I created this webtest in VS2010, I found that there was a bug with the Extract Regular Expression when the Required property was False. This
    thread showed the code for a custom Extraction rule to fix the problem. When I run this webtest in VS2013, both the built-in Extract Regular Expression and the custom Extract Regular Expression Not Required are not creating the Context Parameter if the
    regex is found.
    Try this yourself:
    Create a webtest
    Add "Extract Regular Expression"
    Set the Regular expression to . (this will match any one character)
    Set the Requiredto False
    Set the Context Parameter Name to TEST
    Run the webtest
    Although the result from the extraction rule will be Passed, there is no Context Parameter TEST created. 
    If you create the custom Extract Regular Expression Not Required plugin, the same problem occurs.

  • How to add regular expression in viewobject bind variables

    Hi,
    Am using java class to set the adf bind variables
    vm.setWhereClause("FIRST_NAME = :fname");
    vm.defineNamedWhereClauseParam("fname", null, null);
    vm.setNamedWhereClauseParam("fname","Alana");
    It works fine and it returns Alana
    But what i want is to set a regular expression where it returns all the names that are starting with A.
    I tried with this.
    vm.setNamedWhereClauseParam("fname","A*");
    also
    vm.setNamedWhereClauseParam("fname","A%");
    but both didn work.
    Please help.
    Thanks,
    Hari

    Perfect... Thanks Arun.
    I tried including last name too. i.e when either of the one matches (first name or last name)
    vm.setWhereClause("upper(FIRST_NAME) LIKE upper(:fname||'%')");
    vm.defineNamedWhereClauseParam("fname", null, null);
    vm.setNamedWhereClauseParam("fname","A");
    vm.setWhereClause("upper(LAST_NAME) LIKE upper(:lname||'%')");
    vm.defineNamedWhereClauseParam("lname", null, null);
    vm.setNamedWhereClauseParam("lname","A");
    But i guess we should not give it like this as it doesnt seem to work.
    Hari

  • How about the statement of regular expression like for this

    I what to get varians String array by one regular express for the statement like:
    ${user} like play ${game} in ${date}
    I want to get String[] as {"user","game","date"} by one regex, by str.split(regex). I tried many times but always fail to get the result I expected. May it be possible to meet the destination?
    thanks in advance
    Frederick

    why StringBuffer was using here?So one could split the pattern into multiple lines. But it just occurred to me that one could just use string concatenation, which would look better. I don't know why I bothered to use StringBuffefer.
    e.g.:
    String pattern =
        "^" +           // the start of a string
        "(dog)|(cat)" + // match either "dog" or "cat" at the start of the line
        "\\s*" +        // match an arbitrary amount of whitespace
        "$";            // but don't allow anything other than whitespace after dog or cat
    Pattern p = Pattern.compile(pattern);
    Pattern p = Pattern.compile("^(dog)|(cat)\\s*$");> isn't this look more simpler and better?
    In this case, yes. I was looking for a way to make regexps more explicit, with whitespace and comments, for more complicated cases.
    But those double quotes and plus signs add ugliness of their own, so a regexp would have to be pretty complex before it would be an improvement.

  • How to use regular expression replace for this special characters?

    hi,
    I need to replace the below string, but i couldnt able to do if we use the special charaters '+', '$' . can anyone suggest a way to do this?
    select REGEXP_REPLACE('jan + feb 2008','jan + feb 2008', 'feb',1,0,'i') from dual
    anwers should be :- feb

    you should use escape character \.
    the regular expression will look like as follows:
    select REGEXP_REPLACE('jan + feb 2008','jan \+ feb 2008', 'feb',1,0,'i') from dual
    hope this is what you needed.
    cheers,
    Davide

  • User exit code required for manadatory variable

    we have vendor in rows  and sales in columns, the requirement is there is a mandatory  variable for retrieving the sales between months, that is if
    customer gives calmonth january as <b>from</b> and march as<b> to</b> the sales should be from Jan to March, if the customer only gives <b>from</b> month and nothing for<b> to</b> month, only <b>from</b> month should be calculated, if the customer gives only<b> to</b> month and no <b>from</b> month, the <b>to</b> month should be calculated. Remember the variable is mandatory.

    Hi,
    Let s say
    var1 is from varaible
    var2 is to variable
    var3 is user exit variable
    USe the code like this:
    DATA:
    l_s_range TYPE rsr_s_rangesid,
    l_s_var TYPE rrs0_s_var_range.
    DATA: LOC_VAR_RANGE LIKE RRRANGEEXIT.
    DATA: LOC_VAR_RANGE2 LIKE RRRANGEEXIT.
    WHEN 'VAR3'.
        IF I_STEP = 2.
          LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE
            WHERE VNAM = 'VAR1'.
          LOOP AT I_T_VAR_RANGE2 INTO LOC_VAR_RANGE
            WHERE VNAM = 'VAR2'.
            CLEAR L_S_RANGE.
            L_S_RANGE-LOW = LOC_VAR_RANGE-LOW(8).
            L_S_RANGE-HIGH = LOC_VAR_RANGE2-LOW(8).
    IF LOC_VAR_RANGE2(8) = '00000000'.
            L_S_RANGE-HIGH = LOC_VAR_RANGE-LOW(8).
    ENDIF.
    IF LOC_VAR_RANGE(8) = '00000000'.
            L_S_RANGE-LOW = LOC_VAR_RANGE2-LOW(8).
    ENDIF.
            L_S_RANGE-SIGN = 'I'.
            L_S_RANGE-OPT  = 'BT'.
            APPEND L_S_RANGE TO E_T_RANGE.
          EXIT.
          ENDLOOP.
          EXIT.
          ENDLOOP.
        ENDIF.
    With rgds,
    Anil Kumar Sharma .P

  • Regular Expression Fails for Large Inputs

    I've got a problem on mu RegEx
    This is happenning for only when I input large files to it.
    My code is shown brlow...
    public static boolean isComment(String line) {
    Pattern pattern = Pattern.compile("((?:/\\*(?:--^*|(?:\\*+--*/--^--))*\\*+/)|(?:--.*))", Pattern.CASE_INSENSITIVE);
    Matcher matcher = pattern.matcher(line);
    return matcher.find();
    public static boolean isNewLine(String line) {
    Pattern pattern = Pattern.compile("^[\\s\n]+$", Pattern.CASE_INSENSITIVE);
    Matcher matcher = pattern.matcher(line);
    return matcher.find();
    public static boolean isKeyWord(String line) {
    Pattern pattern = Pattern.compile("^[ \t\n]*(DECLARE|PACKAGE|TRIGGER|PROCEDURE|TYPE|CREATE|ALTER)", Pattern.CASE_INSENSITIVE);^
    ^Matcher matcher = pattern.matcher(line);^
    ^return matcher.find();^
    ^}^
    ^public static String isCTExists(String regEx, String line) {^
    ^Pattern pattern = Pattern.compile(regEx, Pattern.CASE_INSENSITIVE);^
    ^Matcher matcher = pattern.matcher(line);^
    ^String s = line;^
    ^while (matcher.find()) {^
    ^s = matcher.replaceAll(replaceCTStr(matcher.group()));^
    ^}^
    ^if (s.equals(""))^
    ^return line;^
    ^else^
    ^return s;^
    ^}^
    ^public static String replaceCTStr(String line) {^
    ^Pattern pattern = Pattern.compile("\\)", Pattern.CASE_INSENSITIVE);^
    ^Matcher matcher = pattern.matcher(line);^
    ^return matcher.replaceFirst("\\)\n/");^
    ^}^
    ^public static String isExists(String regEx, String line) {^
    ^Pattern pattern = Pattern.compile(regEx, Pattern.CASE_INSENSITIVE);^
    ^Matcher matcher = pattern.matcher(line);^
    ^String s = line;^
    ^while (matcher.find()) {^
    ^s = matcher.replaceAll(replaceStr(matcher.group()));^
    ^}^
    ^if (s.equals(""))^
    ^return line;^
    ^else^
    ^return s;^
    ^}^
    ^public static String replaceStr(String line) {^
    ^Pattern pattern = Pattern.compile("END[ \t]*;", Pattern.CASE_INSENSITIVE);^
    ^Matcher matcher = pattern.matcher(line);^
    ^return matcher.replaceFirst("END;\n/");^
    ^}^
    ^public static boolean isHaveEnding(String line) {^
    ^Pattern pattern = Pattern.compile("(END[ \t\"A-Za-z_]*;[ \t\n]*)$|([\\)]{1}[ \t\n]*)$", Pattern.CASE_INSENSITIVE);^
    ^Matcher matcher = pattern.matcher(line);^
    ^return matcher.find();^
    ^}^
    ^public static String checkCTMid(String regEx, String line) {^
    ^Pattern pattern = Pattern.compile(regEx, Pattern.CASE_INSENSITIVE);^
    ^Matcher matcher = pattern.matcher(line);^
    ^boolean notEnded = false;^
    ^String s = "";^
    ^String temp = "";^
    ^while (matcher.find()) {^
    ^if (matcher.group() != null) {^
    ^if (isComment(matcher.group())) {^
    ^s += matcher.group();^
    ^} else if (isNewLine(matcher.group())) // all the new line characters handled here...^
    ^{^
    ^s += matcher.group();^
    ^continue;^
    ^}^
    ^}^
    ^if (matcher.group(1) != null && !matcher.group(1).equals("")) {^
    ^if (notEnded && isKeyWord(matcher.group(1))) {^
    ^s += "\n/";^
    ^notEnded = false;^
    ^} else^
    ^notEnded = false;^
    ^temp = isCTExists("(\\)[ \n\t\r]*--;--^(?:DECLARE|PACKAGE|TRIGGER|PROCEDURE|TYPE|CREATE|ALTER))", matcher.group(1));
    temp = isExists("(END;[ \n\t\r]*[^/](?:DECLARE|PACKAGE|TRIGGER|PROCEDURE|TYPE|CREATE|ALTER))", temp);
    s += temp;+
    +if (isHaveEnding(matcher.group(1))) {+
    +notEnded = true;+
    +}+
    +}+
    +}+
    +return s;+
    +}+
    +public static void main(String[] args) {+
    +String str = readFile("test.txt");+
    +System.out.println("Read Compleate");+
    +String strWithoutComments = checkCTMid( "(?:/\\*(?:--^*--|(?:\\*+--^/*--))*\\*+/)|(?:--.*)|((?:--^/-++|/(?!\\*)|-(?!-))*+)" , str ); //ok^--
    --^String strWithoutbSlashMiddleEndForCT = isCTExists( "(\\)[ \t\n\r]*--;/--^--$)" , strWithoutComments);
    String strWithoutbSlashMiddleEnd = isExists( "(END;[ \t\n\r]*--^/--$)" , strWithoutbSlashMiddleEndForCT);
    System.out.println(strWithoutbSlashMiddleEnd);
    {code}
    This code is currently parse SQL statements and add '/' characters finding the missed places.
    When i give this 'test.txt' as a long file (with 10000 LOC) gives belov error.
    *Exception in thread "main" java.lang.StackOverflowError*
    * at java.lang.Character.codePointAt(Character.java:2335)*
    * at java.util.regex.Pattern$BitClass.match(Pattern.java:2873)*
    * at java.util.regex.Pattern$Branch.match(Pattern.java:4530)*
    * at java.util.regex.Pattern$GroupHead.match(Pattern.java:4570)*
    * at java.util.regex.Pattern$Loop.match(Pattern.java:4697)*
    * at java.util.regex.Pattern$GroupTail.match(Pattern.java:4629)*
    * at java.util.regex.Pattern$BitClass.match(Pattern.java:2876)*
    * at java.util.regex.Pattern$Branch.match(Pattern.java:4530)*
    * at java.util.regex.Pattern$GroupHead.match(Pattern.java:4570)*
    * at java.util.regex.Pattern$Loop.match(Pattern.java:4697)*
    * at java.util.regex.Pattern$GroupTail.match(Pattern.java:4629)*
    * at java.util.regex.Pattern$BitClass.match(Pattern.java:2876)*
    * at java.util.regex.Pattern$Branch.match(Pattern.java:4530)*
    * at java.util.regex.Pattern$GroupHead.match(Pattern.java:4570)*
    * at java.util.regex.Pattern$Loop.match(Pattern.java:4697)*
    * at java.util.regex.Pattern$GroupTail.match(Pattern.java:4629)*
    * at java.util.regex.Pattern$BitClass.match(Pattern.java:2876)*
    * at java.util.regex.Pattern$Branch.match(Pattern.java:4530)*
    * at java.util.regex.Pattern$GroupHead.match(Pattern.java:4570)*
    * at java.util.regex.Pattern$Loop.match(Pattern.java:4697)*
    * at java.util.regex.Pattern$GroupTail.match(Pattern.java:4629)*
    * at java.util.regex.Pattern$BitClass.match(Pattern.java:2876)*
    * at java.util.regex.Pattern$Branch.match(Pattern.java:4530)*
    * at java.util.regex.Pattern$GroupHead.match(Pattern.java:4570)*
    * at java.util.regex.Pattern$Loop.match(Pattern.java:4697)*
    * at java.util.regex.Pattern$GroupTail.match(Pattern.java:4629)*
    * at java.util.regex.Pattern$BitClass.match(Pattern.java:2876)*
    * at java.util.regex.Pattern$Branch.match(Pattern.java:4530)*
    * at java.util.regex.Pattern$GroupHead.match(Pattern.java:4570)*
    * at java.util.regex.Pattern$Loop.match(Pattern.java:4697)*
    * at java.util.regex.Pattern$GroupTail.match(Pattern.java:4629)*
    * at java.util.regex.Pattern$BitClass.match(Pattern.java:2876)*
    This is not hapenning for small files.
    Can anyone help!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Let's see if I can get this to display as intended: {noformat}(?:/\*(?:[^*]|(?:\*+[^/*]))*\*+/)|(?:--.*)|((?:[^/-]++|/(?!\*)|-(?!-))*+){noformat} Okay, when I try that regex (in EditPad Pro, against the source code of this web page), I see this result: The second alternative, {noformat}(?:--.*){noformat} matches anything from a double hyphen to the end of that line, and the third alternative: {noformat}((?:[^/-]++|/(?!\*)|-(?!-))*+){noformat} matches everything else (up to the next double hyphen, that is). These pages happen to contain a lot of SGML comments, so there are plenty of double hyphens to match. In a large document with only a few double hyphens, it would be easy to blow the stack trying to find the next stopping point.
    What exactly is the isComment() method supposed to do? Are you trying to match a line that consists entirely of a comment, or just a line that contains a comment? And how exactly do you define a comment?

  • Regular Expression needed for a password validator

    Business Rules:
    Password must be at least 8 characters
    Contain at least 1 non alpha character and no spaces.
    Here is what I got so far:
      String regex = "(?=^.{8,}$)((?!.*\\s)(?=.*[^a-zA-Z])(?=.*[a-zA-Z0-9]))^.*$";
            String [] password = new String [7];
            password [0] = "H@ffman1";
            password [1] = "hoffman1";
            password [2] = "Hoffman1";
            password [3] = "Hoffman 1";
            password [4] = "hoffman 1";
            password [5] = "hoffmans";
            password [6] = "123456789";
            for(int i=0; i<password.length; i++){
                Pattern pattern = Pattern.compile(regex.trim());
                Matcher matcher = pattern.matcher(password);
    System.out.println(password[i] + " == " + matcher.matches());
    }Output:
    H@ffman1 == true
    hoffman1 == true
    Hoffman1 == true
    Hoffman 1 == false
    hoffman 1 == false
    hoffmans == true // (This is a problem)
    123456789 == true // (This is a problem)

    YoungWinston wrote:
    prometheuzz wrote:
    which is pretty much what our OldWinston suggested...Actually, I was thinking more along the lines of
    System.out.println( password.matches("^[^\\s]{8,}$")
    && password[i].matches("[^a-zA-Z]") );
    (I may have got the number of backslahes wrong; 'always forget that stuff).Ah, I see. But you probably meant:
    password.matches(".*[^a-zA-Z].*")and they're cryptic enough as it is :-).
    Cryptic? Nah...

  • Regular Expression match for BOM char .

    i am trying to match BOM char in file with regex but \\ufeff seem to be not working .
    please suggest solution on this

    This line               String srcStr = new String(b);will only produce the String you expect if the BOM bytes can be converted to characters under your default character encoding. They probably can't.
    I use this class
    public class BOMStripperInputStream extends PushbackInputStream
        public static final int[][] BOMS =
                0x00, 0x00, 0xFE, 0xFF
                0xFF, 0xFE, 0x00, 0x00
                0x2B, 0x2F, 0x76, 0x38
                0x2B, 0x2F, 0x76, 0x39
                0x2B, 0x2F, 0x76, 0x2B
                0x2B, 0x2F, 0x76, 0x2F
                0xDD, 0x73, 0x66, 0x73
                0xEF, 0xBB, 0xBF
                0x0E, 0xFE, 0xFF
                0xFB, 0xEE, 0x28
                0xFE, 0xFF
                0xFF, 0xFE
        static private int testForBOM(int[] bom, int[] bytes)
            for (int index = 0; index < bom.length; index++)
                if (bom[index] != bytes[index])
                    return 0;
            return bom.length;
        public BOMStripperInputStream(InputStream is) throws IOException
            super(is, 4);
            final int[] bytes =
                read(), read(), read(), read()
            int count = 0;
            for (int[] bom : BOMS)
                count = testForBOM(bom, bytes);
                if (count != 0)
                    break;
            for (int index = bytes.length - 1; index >= count; index--)
                if (bytes[index] != -1)
                    unread(bytes[index]);
    }to get rid of a BOM .

  • Regular Expression Query for SQL

    Hi,
    I am working on SQL server and there is a requirement of separating street name and street number. 
    I tried using regexp_substr but not able to do it perfectly.
    Here are some sample names which need cleansing
    Full name 
    street name
    street no
    Bahnhofplatz 1 / Werkstatt
    Bahnhofplatz
    1 / Werkstatt
    Reinacherstr. 149/151
    Reinacherstr.
    149/151
    Kosuth UCA 7/A
    Kosuth UCA
    7/A
    Route des Jeunes 9 / 6 ème
    Route des Jeunes
    9 / 6 ème
    L'Arcadie / Route de Moudon
    L'Arcadie / Route de Moudon
    null
    Hofstetten 206
    Hofstetten
    206
    Rgds
    Amitabh

    try this
    DECLARE @test TABLE (address VARCHAR(50))
    INSERT INTO @test values ('Bahnhofplatz 1 / Werkstatt')
    ,('Reinacherstr.149 / 151')
    ,('Kosuth UCA 7 / A')
    ,('Moudon')
    ,('L''Arcadie / Route de')
    SELECT
    Address,
    CASE
    WHEN patindex('%[0-9]%',address) = 0 then address else substring(address,0,patindex('%[0-9]%',address)) end col1,
    CASE WHEN patindex('%[0-9]%',address) >0 then SUBSTRING(address,patindex('%[0-9]%',address),LEN(address)) end col2
    from @test
    Address col1
    col2
    Bahnhofplatz 1 / Werkstatt
    Bahnhofplatz 1 / Werkstatt
    Reinacherstr.149 / 151
    Reinacherstr. 149 / 151
    Kosuth UCA 7 / A
    Kosuth UCA 7 / A
    Moudon Moudon
    NULL
    L'Arcadie / Route de
    L'Arcadie / Route de
    NULL
    --Prashanth

  • Correct regular expression format for hub transport rule??

    I want to create a regex such that it tests for two words with a space between them.
    Exchange says /abc(\s)def/ig -- abc def or ABC DEF will pass the test -- Exchange says /mls(\s)secure/ig regex won't work.
    How do I write the regex so it works in Exchange 2010??
    Thank you, Tom

    Hi Tom,
    As Amit said, you can test the regex via EMS.
    I have some tests in my environment using Exchange 2010. "abc def" -match "/abc(\s)def/ig" is false. Also, "ABC DEF" -match "/abc(\s)def/ig" is false. You can use the "^\w+\s\w+$" regex to test for two words with a space between them.
    Hope it helps.
    Best regards,
    Amy Wang
    TechNet Community Support

  • Regular expression help for matching numbers

    Hi,
    I want a exact match of either 9 digits or 12 digits, my query should give "No Match Found" as the input value is actually 10 digit
    select case when regexp_like(regexp_replace( ' 123 4567 890', ' ' ), '^([0-9]{9})|([0-9]{12})$')
    then 'Match Found'
    else 'No Match Found'
    end as test
    from dual;
    Need help, as I must be doing something very basic thing, wrong.
    Regards,
    Ash

    Remove 2 brackets:
    SQL> select case when regexp_like(regexp_replace( ' 123 4567 890', ' ' ), '^([0-9]{9}|[0-9]{12})$')
      2  then 'Match Found'
      3  else 'No Match Found'
      4  end as test
      5  from dual;
    TEST
    No Match Found
    SQL> select case when regexp_like(regexp_replace( ' 123 4567 89', ' ' ), '^([0-9]{9}|[0-9]{12})$')
      2  then 'Match Found'
      3  else 'No Match Found'
      4  end as test
      5  from dual;
    TEST
    Match Found
    SQL>

Maybe you are looking for