2B or not 2B? A regular expression problem

I am seeking to understand my error in the attached VI.  The LV help states the following regarding usage examples:
A sequence of one or more digits
[0-9]+
One or more characters other than digits
[~0-9]+
So why does my code return the exact same result for both the positive and negative cases?
Thanks.
Attachments:
re problem.vi ‏55 KB

Try changing your "~" to a "^".
Tilda ? Acent Grave?
I seem to remeber reading there was a typo in the help somewhere. ( tend to read the help file "with a jondous eye" Also for Hamlet. )
Ben
Message Edited by Ben on 04-24-2009 01:31 PM
Ben Rayner
I am currently active on.. MainStream Preppers
Rayner's Ridge is under construction

Similar Messages

  • Regular Expressions - Problem

    Hi @ all,
    I need a complicate regular expression, I don´t know.
    I have a big folder with many .htm pages (800-1000) and I have to do the following:
    http://www.domain.de/ab%32-xyz?myshop=123
    I have to delete the "ab%32-xyz", the problem is, that in this are, there could be every symbol, letter or number.
    So the area between "http://www.domain.de/" and "?myshop=123" (these 2 areas are everytime identical in all documents) shoud be deleted.
    Could everyone say me, how to do this with regular expressions in dreamweaver?
    Thanks,
    Felix
    P.S.: Sorry, my Engish is not so good, I´m from Germany

    Do you want to replace the random text with anything?
    If not, this is how you do it in DW:
    Make a backup of the folder you want to edit, just in case anything goes wrong
    Edit > Find and Replace
    In the Find and Replace dialog box, select Folder from the "Find in" drop-down menu, and select the folder you want to work with.
    Select Source Code from the Search drop-down menu.
    Put the following code in the Find text area:
    (http://www\.domain\.de/)[^?]+(\?myshop=123)
    Put the following code in the Replace text area:
    $1$2
    In Options, select the "Use regular expression" check box.
    Click Replace All. Dreamweaver will warn you that the operation cannot be undone in pages that aren't currently open. As long as you have made a backup, click OK to perform the operation.

  • Interesting Regular Expression Problem

    Hi - I am fairly new to Java, but have some reg exp experience.
    Basically, I would like a regular expression to strip elements out of a text format. The elements are delimited by curly braces, very similar to Java. The problem is that the elements may contain other elements - the format is hierarchical. I need to extract the whole element, including its children.
    For example, I need to extract the B element from
    [A]
    a1     1
    a2     2
    b1     1
    b2     2
    [C]{
    c1     1
    c2     2}
    [C]{
    c1     3
    c2     4}}
    and the answer should be
    b1     1
    b2     2
    [C]{
    c1     1
    c2     2}
    [C]{
    c1     3
    c2     4}}
    The nature of the format is not fixed - I won't know how many child elements the B element contains.
    Can this be done using regular expressions, or do I have to write a custom string handling function?
    Thanks for any help.
    Mark

    :-) And I still don't understand it!It's quite easy though ;-) Suppose a word w is generated by some grammar.
    If this grammar is regular you can write word w as xyz where y is not the empty
    word and |x| < p. if w is generated by a regular grammar then xy^nz
    (n occurrences of y) can also be generated by the same grammar. That's
    the 'pumping' giggle part.
    Now suppose the language of nested parentheses is a regular language.
    All you have to do is find a word w = xyz where xy^nz is not part of the language.
    Let w= ((())) and x= ((, y= ( and z= ))), obviously xy^nz is not a properly nested
    parentheses word for n > 1. Note that every generated word in that language,
    long enough has to have that value p, where xy^nz |x| < p and xy^nz in the language.
    The pumping lemma giggle for context free languages is almost the same:
    you have to find two positions where the pumping fails/succeeds.
    kind regards,
    Jos (huhuh, he said 'pumping' ;-)

  • Simple regular expression problem

    Hello,
    I need help with regular expressions. I have a situation when I need to get data from one table to another and I think my problem can be solved using REG EXP, but I don't know how to use them properly.
    I need to seperate varchar2 fileld whcih is basically number/number into 2 seperate number fields
    CREATE TABLE tst (CODE VARCHAR2(10));
    INSERT INTO tst VALUES('10/15');
    INSERT INTO tst VALUES('13/12');
    INSERT INTO tst VALUES('30');
    INSERT INTO tst VALUES('15');
    CREATE TABLE tst2 (po NUMBER, co NUMBER); I need to get code into co and po columns. I think result should look something like this, but:
    INSERT INTO tst2
    SELECT regexp_substr(CODE 'something here to get the number before /') AS po,
           regexpr_substr(CODE 'something here to get number after') AS co
    FROM tst;   Any help appreciated

    Hi Blu,
    Yes, I have tested with "0" in the figure (like 10/20 30/40). And it worked that time and then I replied. :) :)
    But Still it has a problem in pattern and rectified it below.
    Like :-
    SQL> select regexp_substr('10/40','[^/][0 9]',1,2) DD from dual;
    DD
    40
    But if I (The way you test) use a non zero value like 43 ; below query will not return 43.
    SQL> select regexp_substr('15/43','[^/][0 9]',1,2) DD from dual;
    DD
    My pattern has a slight mistake("-" missing between 0 and 9) and I changed and retested . Correct pattern - '[^/][0-9]' and now it will return 43..
    SQL> select regexp_substr('15/43','[^/][0-9]',1,2) dd from dual ;
    DD
    43this '[^/]+' pattern also works fine.
    Thank you for pointing out Blu; as I came to know lot more about patterns.
    Regards,
    Ashutosh

  • Regular expression problem?

    Hi I have a file which contains the following text
    <cfset objNews.strNewsTickerLink =
    "index.cfm?pageid=83">
    Now what i'd like to do is to scrape out the value of this
    variable i.e. 'index.cfm?pageid=83'. Now this variable can be
    different.... so basically whatever the value of the variable
    objNews.strNewsTickerLink is set to.. I'd like to get it out. Now
    I'm not that great with regular expressions... can anyone help me
    out?
    Thx

    Hi,
    One way of handling that is to use this UDF,
    http://cflib.org/udf/queryStringGetVar
    But, you must be aware of the url variable that comes after
    "?" symbol in order to use the above udf. If it is dynamically
    generated you need to write your own regular expression.
    HTH

  • Find/replace and regular expression problem

    Hello, i'm using find and replace with a regular expression
    for the first time. I have it checkmarked and it's finding my text
    but it's missing (not highlighting) the ')' at the end of the line.
    Here's my code:
    [($[0-9]+<font size="-2">US</font>)]
    it's supposed to find everything inside the square brackets -
    but it misses the closing parenthesis after </font>. I need
    to find this string and replace with nothing to remove the string
    from any/all pages. Is there a reason why it's missing the closing
    parenthesis? I was actually able to add a few more parenthesis
    (e.g. "))))") before OR after the closing square bracket and it
    still found the original text minus the closing bracket and the
    extra parenthesis didn't prevent the text from being found.
    Any help is appreciated!
    James...

    WyattEA wrote:
    > Hello, i'm using find and replace with a regular express
    for the first time. I
    > have it checkmarked and it's finding my text but it's
    missing (not
    > highlighting) the ')' at the end of the line. Here's my
    code:
    >
    > [($[0-9]+<font size="-2">US</font>)]
    That's not how square brackets work
    Try:
    \(\$\d+<font size="-2">US</font>\)
    A left parens, followed by the dollar sign, followed by at
    least one
    digit, followed by <font size="-2">US</font>,
    followed by a right parens.
    Mick
    >
    > it's supposed to find everything inside the square
    brackets - but it misses
    > the closing parenthesis after </font>. I need to
    find this string and replace
    > with nothing to remove the string from any/all pages. Is
    there a reason why
    > it's missing the closing parenthesis? I was actually
    able to add a few more
    > parenthesis (e.g. "))))") before OR after the closing
    square bracket and it
    > still found the original text minus the closing bracket
    and the extra
    > parenthesis didn't prevent the text from being found.
    >
    > Any help is appreciated!
    >
    > James...
    >

  • JAVA regular Expression problem

    i have a string AS FOLLOWS-
    "N\E'\ERAJ";
    u can create this string as --- > String str="N\\E'\\ERAJ "
    i want output as below--
    N\\E\'\\ERAJ
    don't us the looping.
    Thanks in advance.
    nJoy the Regular Expression.

    String myString = myString.replaceAll("\","\\");No. To merely double all backslashes, you would use  myString = myString.replaceAll("\\\\", "\\\\\\\\");But it looks like the OP wants to escape apostrophes as well:  myString = myString.replaceAll("(['\\\\])", "\\\\$1");...or possibly all punctuation characters:  myString = myString.replaceAll("(\\p{Punct})", "\\\\$1");

  • Regular Expression, problem when the literals have content "I_"

    Hi,
    I guess this seems to be an Oracle bug/defect. If I am doing it wrongly, please let me know.
    I need to remove the "_VERSION" which comes at the last of a string column. For e.g, If the string is WINDOWS_XP_VERSION, then the output should be WINDOWS_XP.
    But if you run the below query,
    SELECT
    REGEXP_SUBSTR('AA_TEST_3_XI_VERSION', '\w+[^_VERSION]') t1,
    REGEXP_SUBSTR('AA_TEST_3_Xi_VERSION', '\w+[^_VERSION]') t2,
    REGEXP_SUBSTR('AA_TEST_3_XIA_VERSION', '\w+[^_VERSION]') t3
    FROM DUAL;
    T1 T2 T3
    AA_TEST_3_X AA_TEST_3_Xi AA_TEST_3_XIA
    1 rows selected
    It seems the issue exists only when I use "I_" and works fine with "i_". I checked with few other characters and it all worked fine.
    Any ideas? I am using 11g.
    Thanks,
    Sharmin

    Folks,
    Thanks for all your helps.
    MichaelS, REGEXO_SUBSTR (str, '(\w+)_VERSION$',1,1,null,1) works, but if any string which does not have "_VERSION", it would return NULL. Also, I had used'$' in my expression and missed to put it in the forum. I am sorry not to make it clear that my column can/cannot end with "_VERSION".
    hm, Thank you for making me understand how the regexp works. I thought if you do a '^' and supply a word, it would be considered together.
    What needs to be done for making negation for a specific word?
    WhiteHat,
    REGEXP_REPLACE is a better option. But in this case, it helps me the same way with the regular REPLACE function as my column will not contain any other '_VERSION' substring.
    I am going to use a regular replace function. select REPLACE('AA_TEST_3_XE_VERSION_VERSION','_VERSION','') substring from dual;
    Thanks once again for all your helps.
    Thanks,
    Sharmin

  • Regular Expressions Problem!!!!!!!!! Please help!

    HI,
    I need to extract the lines of a aperticular file without the comments.
    I have a code to catch the comments, But don't know how to how to get the lines without the matching comment lines
    This is the RegEx to catch the line comments.
    ((?:/\\*(?:[^*]|(?:\\*+[^*/]))*\\*+/)|(?:--.*))
    Eg:
    String s = "Something /*rarely*/ usefull";
    As an example, I need to extract the "Something usefull" from the above string.
    Please Help!!!!!!

    UI-ZEIKVK wrote:
    Thanks for the quick reply,
    The above RegExp matches the comments of multiple lines.
    Buth the problem is i need to get the String without that comments.Well see if it was me I wouldn't be looking do this all in one go. Why not strip all the comments first and then get the lines you want? Wouldn't that be easier?
    Because to be honest I'm sure one of the regex gods may be able to help you, although I have a feeling it's not possible (he said, casually throwing down the gauntlet) but even if it is. Is it a good idea? Methinks not. I think there are two pieces of business logic you are applying here. 1) removing comments. 2) extracting content you want. Seems to me to be a better idea to keep that as two steps. Then later if, for example, you wanted to get all the numbers you don't have to repeat the hackery of removing all the comments because that piece is encapsulated already by itself quite nicely.

  • A Regular Expressions problem

    Hi :)
    I have define a Pattern: [{alnum}{L}]+ to find a word, but i still want this pattern to avoid some words that i don't want, such as "hello", "how"...etc. How do I define a new Pattern to fit this request. thx:)

    You need a negative lookahead assertion (see
    http://jregex.sourceforge.net/syntax.html#asserts),
    which looks like (?!...), plus a word boundary in the
    beginning to enforce matching the entire word.
    For example, the pattern that matches any word but
    "hello" and "how", looks like
    \b(?!hello|how)[{Alnum}{L}]+\bthough I am not sure that Sun's library support it
    correctly (jregex does it perfectly), at least i saw
    some complaints.Thx a lot :)
    Sun's library seems doesn't support it correctly, i use \b(?!hello|how)[{alnum}{L}]+\b and it find nothing (target is any word), using (?!hello|how)[{alnum}{L}]+ it find "ello" (target is hello)....
    >
    Try the above pattern against "hello foo how bar" in a
    demo applet here
    http://jregex.sourceforge.net/demoapp.html
    I just tried the demo, it works:) but it still has a problem. I use that pattern you posted and it does skip hello and how, but it also skip hello{Alnum}+, for example, helloo, hellopmm...etc. It finds {Almun}+hello, helllllllo, thought. What's the problem?
    BTW, shouldn't it be {Alnum} instead of {alnum}?
    At least
    http://java.sun.com/j2se/1.4/docs/api/java/util/regex/P
    ttern.html claims so.oh, that is because i'm using jdk1.4 beta-1, it is {alnum} instead of {Alnum}. : )

  • Regular expression problem:  large ORs and stack overflow

    I am trying to search a large text block for pattern matches to any of 50,000 strings.
    For example:
    java.util.regex.Pattern p = Pattern.compile("cat|dog|mouse|blowfish");
    // except with 50K animals...
    This fails with java.util.regex when compiling the pattern. Around 4K animals I get this error:
    Exception in thread "main" java.lang.StackOverflowError
    at java.util.regex.Pattern$Node.study(Pattern.java:2623)
    at java.util.regex.Pattern$Node.study(Pattern.java:2624)
    at java.util.regex.Pattern$Slice.study(Pattern.java:3121)
    at java.util.regex.Pattern$Branch.study(Pattern.java:3760)
    at java.util.regex.Pattern$Branch.study(Pattern.java:3760)
    jregex.sourceforge.net fails in a different way. It allows the creation of the pattern (jregex.Pattern p = new Pattern("cat|dog...")), but then after
    a single match (Matcher.find()), gets a similar error if there are more than about 6K animals:
    Exception in thread "main" java.lang.StackOverflowError
    at jregex.SearchEntry.reset(jregex/Matcher.java:2281)
    at jregex.SearchEntry.reset(jregex/Matcher.java:2281)
    Does anyone know how to get past these problems?
    Is there another way to do this?
    Or is there another java regexp package out there which
    can handle large disjunctions, hopefully efficiently?
    Thanks!

    Good point -- indeed, I don't need the full expressive power of NFAs... yet I don't see a way to use either the java.util.regex or the jregex package and somehow internally perform a NFA to DFA conversion for the subset of power I need.
    So does anyone know of a good java DFA regexp package?
    Or a way to trick an NFA into doing this pattern match efficiently?
    Otherwise, I'll just have to write my own...

  • ServerStats regular expression problem

    Hi,
    I'm trying to make a simple metric. The metric command returns one line with a number (12).
    I've tried /([0-9])+\s/
    But that only returns console.configFailureAlert
    Last output:ps -ef|grep afapi|grep -v grep|wc -l 12 -bash-3.2$ -bash-3.2$
    Any suggestions?
    Edit: Tried /([0-9]+)/ too. But it only gives a result for key -1, and the result is "3".
    Regards,
    Alex
    Edited by: ao on 2011-maj-25 14:12

    HI sabre.I was just waiting 4 ur reply.
    What u hav e provided me ,i kNow it already,but this is n't what i want
    I wud like to elaborate it further by giving another example of pattern for IF statement
    IF statement pattern is of following kind:(not according to Java syntax)
    IF condition Then
    statements
    else
    statements
    statements can be any statements like function call, input ,output statement,mathematical expression etx
    Now,
    Inside If can come another If statement.so its like calling itself .
    So if we talk in terms of regex iit will be like :
    IFPattern =  IF Condition THEN statements ELSE|ELSEIF statements
    where statements = (INPUT|OUTPUT|MATHEMATICAL EXPRESSION|IFPattern)I think its now clear what i am asking for

  • Regular Expression Problems

    I'm trying to write a program which parses through all of my JSP pages and extracts the SQL from my <sql:query/> tags.
    Example:
    <sql:query>
      select foo
      from bar
      where foo is not null
    </sql:query>
    Here's the code I'm trying to use:
    (I'm using the gnu.regexp packages)
          RE sqlFinder = new RE(
              "<sql:query.*>(.*)</sql:query>",
              RE.REG_DOT_NEWLINE);
          REMatch[] matches = sqlFinder.getAllMatches(jsp);
          System.out.println("Found " + matches.length + " matches");
          for (int i = 0; i < matches.length; i++) {
            REMatch match = matches;
    String sql = match.toString(1);
    System.out.println("Sql: " + sql);
    It's not finding any matches in about 80% of the pages. In the other 20%, it's finding the SQL half the time and the rest of the time it's an empty String. I'm not sure what I'm doing wrong here.
    I find it odd because it works in some pages and not in others. I'm not the greatest regex hacker out there so maybe someone out there can offer some assistance??
    Can anyone offer some insight?

    I vaguely recall (it's been a while since I used it) that gnu.regexp has trouble dealing with multiple .*'s (or anything that generates a lot of backtracking). But even if that were not the case, your regex would have matched too much (i.e., everything from the first "<sql:query>" to the last "</sql:query>") instead of nothing at all. As a rule of thumb, you should try to be specific about what should or shouldn't be matched at any given point, instead of using .*. It may make the difference between an incorrect regex and a correct one, and it will certainly make your regex more efficient.

  • Regular expression problem - pls help

    I would love to have a reg exp that checks for:
    a-z
    +0-9+
    +'_'+ as well as +'-'+
    as well as the DOT character.
    How can this happen ?
    I have tried both:
    [a-z0-9_-\\Q.\\E]+as well as
    [a-z0-9_-\\.]+and I am given:
    java.util.regex.PatternSyntaxException: Illegal character range near index 10
    [a-z0-9_-\Q.\E]+Please help
    Thank you

    javaUserMuser wrote:
    No, because it is not a metacharacter as defined by the Pattern javadoc.
    What's going on still remains a mystery to me as of now.???
    but it has very definite meaning as the range operator when used in a regex, and the strange thing is that you use it yourself in this defined meaning:
    [a-z0-9_-\\Q.\\E]+{code}
    How can you see that it doesn't need to be escaped when here you use - to show the range for letters and numbers: a-z and 0-9?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Feedback / Submit an idea don't Work (Page not found) || Multiline Regular Expression Search

    Hello,
    I reached for some months an idea with a (multiline edeting, regexp search).
    Nice to see this has already been integrated, making me but disappointing is the regex search, in combination with the Multiline Edeting.
    But what it brings me to use the regexp search, when I cant edit all hits.
    In this feature, I would like to point again.
    But unfortunately I cant find the feedback system, and here in the forum I always get the error message, page not found.
    Beautiful would be if both would be patched;)
    For me, the code is currently the "http://www.sublimetext.com/" editor of my choice if Adobe would therefore produce some its functions, edge code would be a real alternative.
    Yet I find Edge Code is not ready for Daily-use.
    Greetings
    Dirk Persky

    Hi Dirk,
    Thanks for reporting the broken links -- we'll look into that.  As Randy said, you're welcome to just post suggestions & issues here in the forum, though.
    Regarding multiline regexp search: that is possible in Edge Code, with some limitations:
    To search multiple files, use the Find in Files command, and then use any regexp containing "\n" -- it will match the newlines correctly.
    To search a single file, right-click the file and chose "Find In..." (it will behave like Find in Files, but limited to that one file)
    Caveat: you can't use the multiline $/^ anchors in your regexp
    Caveat: there's no workaround for using the Replace command with multiline regexps
    The latest Brackets release 0.41 fixes both the caveats listed above -- though you'll still have to use the "Find In..." workaround (or "Replace In..." for Replace).  We eventually plan to further improve this -- you can watch the full multiline search/replace item on our feature backlog for updates.
    Hope that helps,
    - Peter

Maybe you are looking for

  • How to do report  daily hour wise data in SAP BI-BO

    We are implementing SAP BI with BO for a Retail Chain and the user wants to do reporting on store level for peak traffic hrs in a day and peak sales hrs in a day. So the format using flat files will be Date | Hour | Store | Footfalls | No. of Cash Me

  • TS1368 How do I authorize my computer for downloads??

    How do I authorize my computer for downloads? Purchased songs, but will only play 30 seconds...says I must authorize my computer!! How do I do that?

  • Crystal crashes when using print or page setup

    I am using Crystal Reports 2008 on Windows VISTA Business OS (32 Bit).  Crystal crashes everytime I hit the page setup or print.  Any suggestions would be helpful.  I am trying to setup a landscape report but cannot even get into the page settings. R

  • DEAR GOD I NEED HELP (Find my iPhone)

    DEAR GOD I NEED HELP! A story about a boy and his phone Okay, so. Before I get started, I will provide you fantastic readers with a small amount of background information. The intent of this is so I only have to explain myself once, you dig? Anyway..

  • Checking multiple conditions in a standard if clause

    Greetings all, I have a PO Template that I want to print a Note at the bottom of each Line (inside the table having the group_by) when the CANCEL_FLAG=Y. But I want to print one Note if the QUANTITY>0 and a different Note if the QUANTITY=0. My curren