How to get mathched amount in a regular expression?

Is there any direct method to know the matched amount in a regular expression? I don't know but have to loop for the Matcher object and count. Too inconvenient !
thanks.

sabre150 wrote:
fxbird2 wrote:
Is there any direct method to know the matched amount in a regular expression? Define please. Do you mean a 'group' ?
I don't know but have to loop for the Matcher object and count. Too inconvenient !Since I don't understand what you mean by "the matched amount" I can't tell if this is correct or not.
You could always produce an SSCCE and ask how it might be improved.No,no,no, just means matched substring, like 2 is the matched amount for "aaabbaa" by "aa".

Similar Messages

  • How to get the meaning of the regular expression?

    Hello All,
    I want to know how to get the meaning of the regular expression?
    The requirement is i need to get the regular expression for some of the attributes and if the value is not matching with that regular expression then i need to give the popup saying the limitation of the attribute. but i need to give the pop up with the user understanding format.
    Like "please give a to z or 1 to 9" like that.
    So is there any way Java will help me to get the meaning of the regular expression?
    Thank You!
    Arun S

    I'm not aware of any such tool or library.
    Also, it would be a terrible "explanation", because regular expressions (similar to other programming languages) have their own "style" of defining what to enter and that usually doesn't translate well into natural language.
    For example the regex "[a-z][a-z0-9]*\s+[a-z0-9]+" could be translated as "a to z, followed by zero or more characters from a to z or 0 to 9 followed by any amount of whitespace followed by one or more characters from a to z or 0 to 9".
    Or you could simply say "Please enter two alphanumeric words, the first one must not start with a number".
    My suggestion: store/configure the human-readable description together with the regex. Don't try to automate it.

  • How to get the amount of free physical memory?

    How to get the amount of free physical memory?
    (without sudo or root)

    vmstat will give it to you.
    Although the question depends a bit on what you mean by free memory.
    The figure vmstat labels free (in any reasonably recent version of solaris) actually represents memory mostly filled with cached file contents. So it represents memory that can be easily released if needed by something more important.
    Like most unix versions, solaris will use any free memory to cache files thats have been read/written previously just in case they are needed again

  • How to get  Unapplied Amount with SQL or API in AR/ORACLE RECEIVABLES

    Hi ,
    how to get Unapplied Amount with SQL or API in AR/ORACLE RECEIVABLES.
    who can help me ? Thank you very much !

    i get it from private API.
    SELECT SUM(decode(ra.status, 'UNAPP', nvl(ra.amount_applied, 0), 0)) unapplied_amount
    FROM ar_receivable_applications ra
    WHERE ra.cash_receipt_id = 1820
    AND ra.status IN ('UNAPP', 'ACTIVITY')

  • Can somebody help me in getting some good material for Regular Expressions and IP Community list

    can somebody help me in getting some good material for Regular Expressions and IP Community list

    I'm not sure what you mean by "IP Community list", but here are 3 reference sites for Regular Expressions:
    Regular Expression Tutorial - Learn How to Use Regular Expressions
    http://www.regular-expressions.info/tutorial.html
    Regular Expressions Cheat Sheet by DaveChild
    http://www.cheatography.com/davechild/cheat-sheets/regular-expressions/
    Regular Expressions Quick Reference
    http://www.autohotkey.com/docs/misc/RegEx-QuickRef.htm

  • How to get total amount between two fiscal years

    i Have a report requirement. I have created a crosstab report where I need to get amount of current year current month(10/2010), current year last month(09/2010),last year last month(10/2009). Here I'm comparing  10/2010 amount with 09/2010 and 10/2009. But now my manager asking to me create report that  compare amount between 2008 and 2009 periods.
    How to get that?
    I have a prompts and I entered  1)fiscal year=2009
                                    2)fiscal period= 9;10
                                    3) account numbers=x;y;z;p;q;r;s
    I entered fiscal year:2009 in the prompt but I need to compare  fiscal year 2009(i.e 10/2009) amount with fiscal year 2008(10/2008).              
                                                                2009/09    2009/10   2008/10
    Account number  account name         amount     amount     amount
    In advance,Thanks for your response

    Is your universe based on a BEx query? If so, create the offset variables in the BEx query.
    If the universe is not based on a BEx query, you will need to create these variables in your universe. I do not believe you can do this directly in Webi.

  • How to get sum amount (wrbtr) from table BSIS group by gjahr hkont monat

    Hello! I am new to this forum, and to ABAP. Hope my question is not obvious.
    I want to get sum amount from table BSIS, group by year, period an account. Normally I will try a SQL select like this:
    SELECT gjahr monat hkont sum( wrbtr ) as wrbtr INTO CORRESPONDING FIELDS OF TABLE itab FROM BSIS WHERE (itabcond) GROUP BY gjahr monat hkont .
    The problem is that the amount in field wrbtr is all positive. The result gets wrong. The debet/credit indicator shkzg determines what is positive/negative. How to solve this in the most efficient way? Should I read all accounting documents into an internal table, and loop through them, changing the sign, and then make some new select, or is there a better way?
    Regards Dag-Egil
    Message was edited by:
            Dag-Egil Bull Sletholt

    Here are the objects in the trace list:
    SKB1
    USR05
    TRDIR
    SKA1
    SKAT
    SKB1
    BSIS
    PRPS
    BSAS
    V_LTDX
    USR02
    RFBLG
    V_LTDX
    LTDX
    RTXTH
    RTXTF
    RTXTT
    TRDIR
    The most of this call to this tables returns 1-2 records, apart from BSIS, where it returns 10 records. This is the same as accounting documents in the transaction FBL3N. When i try this again with more records returned I still have no call to table GLT0.

  • How to get - Net amount for accounting doc in the SD doc flow?

    Hi,
    In my report I have to show the net amounts from the Sales doc, invoice and accounting doc, etc.
    I got the FI doc amount from BSEG, however there the gross amount is stored.
    I noticed that in the SD document flow for the accounting document the net amount is shown.
    I tried with the following calculation, however in some cases this doesn't work (eg there is separate tax item in the FI doc):
    "<lwa_bseg>-wrbtr - <lwa_bseg>-wmwst"
    Is there a function module/sap standard code to provide this data?
    Thanks in advance,
    Peter

    when u see the Item Header in SO or Billing , at the Head of Condition table u will get NET amount ?
    are u not maintaining any seperate conditions for this NET amount ?
    have a word with ur functional guys , so he can help u out.
    Regards
    Peram

  • How to get tax amounts related to PO

    Dear All,
    I have to write a report based on PO and taxes related to it.
    I have got the PO details, but how to get the tax details like service tax, Excise , SHcess.
    I get some details in KONV table but when I check the PO taxes there are more no. of taxes.
    miro  has not been done for that PO.
    Please help,
    Thanks in advance,
    Salman Zahir

    Hi,
    Please Use the FM : CALCULATE_TAX_ITEM to fetch all taxes pertaining to PO and line Item.
    Before this we have to use FM:'REFRESH_TAX_TABLES'.
    Check the sample code for your reference.:
    LOOP AT it_ekko_ekpo INTO is_ekko_ekpo.
        CALL FUNCTION 'REFRESH_TAX_TABLES'
        EXPORTING
          LIVERY        = 1
        CONCATENATE '0' is_ekko_ekpo-ebelp INTO w_ebelp.
    *"--- Assigning values to Taxcom
        is_taxcom-bukrs = is_ekko_ekpo-bukrs.
        is_taxcom-budat = is_ekko_ekpo-bedat.
        is_taxcom-ebeln = is_ekko_ekpo-ebeln.
        is_taxcom-kposn = w_ebelp.
        is_taxcom-mwskz = is_ekko_ekpo-mwskz.
        is_taxcom-lifnr = is_ekko_ekpo-lifnr.
        is_taxcom-matnr = is_ekko_ekpo-matnr.
        is_taxcom-werks = is_ekko_ekpo-werks.
        is_taxcom-land1 = is_ekko_ekpo-lands.
        is_taxcom-wrbtr = is_ekko_ekpo-netwr.
        IF is_taxcom-mwskz IS NOT INITIAL.
    *"--- Function Module to get Condition types
          CALL FUNCTION 'CALCULATE_TAX_ITEM'
            EXPORTING
              i_taxcom            = is_taxcom
            TABLES
              t_xkomv             = it_komv
            EXCEPTIONS
              mwskz_not_defined   = 1
              mwskz_not_found     = 2
              mwskz_not_valid     = 3
              steuerbetrag_falsch = 4
              country_not_found   = 5
              OTHERS              = 6.
          IF sy-subrc <> 0.
            MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
          DELETE it_komv WHERE kbetr = 0.
          LOOP AT it_komv INTO is_komv.
            is_out-kschl = is_komv-kschl.
            APPEND is_out TO it_out.
          ENDLOOP.
          CLEAR: is_taxcom,
                w_ebelp.
        ENDIF.
      ENDLOOP.
    thanks
    Eswar Rao

  • How to get PO Amount Release in the PO/BAP form

    There is a field in the PO/Blanket Purchase Order from, PO_HEADERS.AMT_RELEASED_DSP , which is calculated when the form open. Does anyone knows if there are any API or program logic to get the amount?
    Thanks in Advance
    Regards
    Lawrence

    Hi,
    Pls refer this link, you will get query
    Blanket Releases Amount
    thanks

  • Get all groups from a regular expression match

    Please help me understand how to use Java regular expressions:
    I have an expression similar to this:
    {noformat}"([^X]+)(X[^X]*)+"{noformat}This should match stuff like "asaasaXdfdfdfXXsdsfd".
    How does one access all the matches for the second group (the second groups has a Kleene operator
    added so it is not really just one group --- but match.groupCount() is always 2)
    Here is roughly the code:
    {noformat}java.util.regex.Pattern pattern = {noformat}{noformat}java.util.regex.Pattern.compile({noformat}{noformat}"([^X]+)(X[^X]*)+",{noformat}{noformat}java.util.regex.Pattern.MULTILINE{noformat}{noformat});{noformat}{noformat}java.util.regex.Matcher matcher = pattern.matcher(text);{noformat}{noformat}matcher.find();{noformat}{noformat}int groupcount = matcher.groupCount();{noformat}
    Also, without matcher.find() I get an illegalStateException .. which I also get if I use matcher.matches() instead
    of matcher.find().
    I am obviously missing something here. There is always at least one "X" in the string so shouldn't that pattern always
    match the whole string? Since there are often multiple X, shouldnt I get a group for each occurrence of X, followed
    by 0 or more other characters?
    {noformat}But when I try to match everything by using "^([^X]+)(X[^X]*)+$" I get an "IllegalStateException: No match available" again.{noformat}
    What is the correct way to do this?
    Edited by: johann_p on May 16, 2008 10:39 AM

    I am sorry I messed this up. Here is a SSCCE:
    import java.util.regex.Pattern;
    import java.util.regex.Matcher;
    class RegExp1 {
        public static void main(String[] args) {
          String testString = "first|aaaa | bbbb\n|cccc|ddddd";
          Pattern pattern = Pattern.compile("^([^|]+)(\\|[^|]*)+$");
          Matcher matcher = pattern.matcher(testString);
          matcher.find();
          int groupcount = matcher.groupCount();
          System.out.println("Found "+groupcount+" groups");
          System.out.println("Matcher: "+matcher);
          for (int i = 1; i <= groupcount; i++) {
            System.out.println("Match "+i+": "+testString.substring(matcher.start(i),matcher.end(i)));
    }I figured out a small bug in my first code that explains some of the exception oddities, but my principal question remains:
    how do I access all the matches that correspond to the second capturing group?
    In the example I would get "first" for Match 1 and "|ddddd" for Match 2, but how do I access all the matches??
    Thank you for your help!

  • How do I have to define a regular expression to filter out data from file?

    Hi all,
    I need to extract parts of lines of a ASCII file and didn't get it done with my low knowledge of regular expressions
    The file contains hundreds of lines and I am just interested in a few lines, within that lines I just need a part of the data.
    One original line looks like that:
    TP3| |TP_SMD|Nicht in Stueckliste|~TP TP_SMD TESTPUNKT|-|0|87.770|157.950|0|top|c| |other|TP_SMD|TP_SMD_60RF-TP
    Only the bold and underlined information is of interest, I don't need the rest.
    I can open that file, read in each line but then I am struggling to pick out only the lines of interest (starting with TP), taking that TP with its number and the coordinates following later on and then writing these shortened lines to a new text file. So the new line should look like that:
    TP3; 87.770;157.950;0 (It doesn't matter if the separator will be ; or |)
    I thought of using regular expressions - is that the right way or is there a better approach?
    Thanks & regards,
    gedi, using LabVIEW 8.5
    Regards,
    gedi

    Hi max,
    for finding a specific part of a string you can use the "Match Pattern" VI, it is located in the Strings Palette.
    Maybe the Extract Numbers.vi example in the examples browser library can help you.
    What I did to filter out my data of interest is first to sort out only the columns which I want to have -
    then there are still a lot of lines remaining I don't need (this is the thing described above).
    The rest I am going to filter out with a (then easy) regular expression with the "Match Pattern" VI.
    Regards,
    gedi
    Regards,
    gedi

  • How to include /(Forward slash) in my regular expression

    Hai All,
    I am having a regular expression which should accept only A-Z,0-9, _(underscore) and .(period) .
    <property name="patterns" value="[A-Z0-9\\._]*" />
    Now i need to add /(Forward slash) to this expression.
    <property name="patterns" value="[A-Z0-9\\._/]*" />
    But when i add it it is accepting both Foward slash and Backward slash.
    Can someone guide me such that it accepts only A-Z, 0-9, Underscore, period and a Forward slash(/).
    Thx in advance..

    sabre150 wrote:
    Your regex without the / was accepting \ since '.' does not need to be escaped inside a character class. Just remove the \\ .And if you really did need to escape the dot, you would only have to use one backslash, not two: <property name="patterns" value="[A-Z0-9\._/]*" /> In Java source code you would have to use two backslashes because one of them gets consumed by the Java compiler. But this is obviously an XML file, so that rule doesn't apply. But, as Sabre pointed out, you don't need a backslash there at all: <property name="patterns" value="[A-Z0-9._/]*" />

  • How to Capture Multiple Line String using Regular Expression?

    Hi, 
    I have a simple program like this:
    What I want to accomplish is to capture everything between >>start and >>end using a single Match Regular Expression node. It seems that setting multiple? to True or False does not help.
    I am using LabVIEW 2012.
    If it is impossible to capture it using a single node, that is fine. But I want to make sure that I can make full use of this node without combining serveral others.
    Thank you!
    TailOfGon
    Certified LabVIEW Architect 2013
    Solved!
    Go to Solution.

    Thank you for the fast response! Your solution worked in the example case
    After I saw your post, I was finally able to step forward. But I still wanted to make use of dot notation due to the limitation of characters that match with \w. 
    I made some more modification to your regular expression then now it seems working for all characters:
    >>start((?:\s|.)*)>>end
    Thanks!
    TailOfGon
    Certified LabVIEW Architect 2013

  • PO: how to get Tax Amount of Invoice Receipt of each Goods Receipt?

    Hi all,
    For a PO, I have got a list GRs with their IRs via table EKBE as below:
    Item 1 -> GR 1 -> IR 1
    Item 2 -> GR 2 -> IR 1
    And I see in table RBKP which have field VAT (WMWST1), this field VAT is VAT amount of IR 1 for both GR 1 & GR 2.
    But I would like to get VAT of IR 1 separately for GR 1 & GR 2 as below:
    Item 1 -> GR 1 -> IR 1 -> I would like to get VAT (tax amount = A USD).
    Item 2 -> GR 2 -> IR 1 -> I would like to get VAT (tax amount = B USD).
    (In table RBKP: field VAT (WMWST1) = C USD = A USD + B USD).
    If anyone know which table I can get A and B separately, please help me?
    Thanks a lot in advance,
    Vinh

    You can pass the Invoice no. + GJAHR (concatenate) to BKPF- AWKEY and output the BELNR.
    Pass BKPF-BELNR to BSEG-BELNR which has fields MWART to identify the tax vlaues (DMBTR or WRBTR).

Maybe you are looking for