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

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

  • 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?

    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...
    >

  • 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 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...

  • 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}. : )

  • 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

  • Regular Expressions problem with OPA

    hi,
    I have version OPA 10.2, when I try using regualr expressions it won't let you submit data and move onto the next screen.
    I've tried for example using the OPA hel's National Insurance number, I tried for a 6 digit number using:
    For a minimum of 6 digits:
    ^\D*(?:\d\D*){6,}$
    and I also tried:
    ^[0-9]{1,6}$
    None of them worked; is there something obvious I'm missing?
    Thanks

    Hello,
    Just tried this out and the two expressions worked as I would expect. I receive the error message as configured in the properties file and cannot progress to the next screen until I enter 6 digits or more. Is that different to the behaviour you are seeing? Also, have you tried using the debugger without screens? The error message would appear at the top of the debug window "Cannot set value of attribute 'test'. Reason: Invalid Value."
    Also, are you trying to validate a text attribute or a number attribute? Number attributes can be a little trickier since the regex appears to run against them after they're converted. So if the user enters "99", the regex validates against "99.0".

  • Pattern and Regular Expression problem

    Hi all!
    I have trouble with constructing a pattern.
    Consider the following:
    import java.util.regex.*;
    public class Parser {
    public Parser() {
    String pattern = "<i18n:message(.*)/>";
    String myline = "<INPUT type=\"button\" name=\"cancel\" value='<i18n:message key=\"EXP.EP.EPDATES.CANCEL\"/>' class=\"normal08\" onClick=\"javascript:disableInput();document.panel_menu.submit();\"/>";
    Pattern p = Pattern.compile(pattern);
    Matcher m = p.matcher(myline);
    while ( (m.find()) ) {
    System.out.println(m.group());
    public static void main(String[] args) {
    new Parser();
    How should I construct the pattern in order to extract from the string myline just the following sequence: <i18n:message key=\"EXP.EP.EPDATES.CANCEL\"/>
    It seems that using the pattern I wrote, it continues the match until the last appearance of "/>", and I need to have the match done until the first appearance of "/>".
    Thanks a lot.

    No, modify it to (.*?).Hey, unky. Would you mind schooling me a bit here?
    "<i18n:message(.*?)/>" right?
    against "<i18n:message key=\"EXP.EP.EPDATES.CANCEL\"/>' class=\"normal08\" onClick=\"javascript:disableInput();document.panel_menu.submit();\"/>"
    I think I understand, but would appreciate confirmation or correction.
    .* is zero or more of anything. The ? makes it reluctant (also called lazy?).
    So .* is compared against nothing, succeeds, and the regex moves on to the next character.
    This doesn't match / so regex backtracks and tries to match .* against the space, which succeeds, but then / doesn't match against the k in key
    So we backtrack, and reluctantly add the k to what .* matches.
    We keep adding a character to .*'s match every time the next character isn't a /.
    Eventually, .* matches everything up to and including the quote before the first />.
    At this point, the / and > literals match, and we're done.
    Yes?
    And we needed to make it reluctant, else the .* would have started by matching as much of the string as it could, gobbling up all of it, and then backtracking to give the /> literals their match at the end of the string.
    Yes?
    Thanks!

  • 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.

Maybe you are looking for

  • My headphone jack wont work its a crackling noise but my headphones work on my phone sum1 help?

    also when i pushd down on the screen itself it fades in and out with the crackling noise

  • How to check service failover  in RAC system

    Hi experts, We have 4 nodes with oracle 10G2 at redhat. we create some service with failover function. some service is not. total 4 services is in system. I try to use below SQL to find services failover function. == select INST_ID,STATUS, FAILOVER_T

  • TCode ABST2 - Msg No MQ555

    Hi When executing TCode ABST2, the below msg displays: Differences between assets and G/L accts in the balance carried forward Message no. MQ555 Diagnosis Differences occurred in the balance carried forward when comparing asset summary records and G/

  • Data displayed on the report in disc plus when used "GROUP BY"

    Hi, I have created a cusom folder, in which the query has group by on 3 columns. So the report in Discoverer plus is showing as Accounting Period     Market      Account     name,     Total billed 200812     xyz     12345     xxxxx,     $12,345.00   

  • Display/content-length issue

    a custom java application merges an image to an PDF document and flattens it using iText. it sets the request header parameters through dynamic javascript and calls the adobe reader to flatten the PDF pages. after the process, the response applicatio