Question related to regex and whitespaces  \s

Hello, i have a problem related to regex.
I have a text area where sm types text. I noticed that when i click on the Enter button (i have a new line) the string is not being recognised.
String regex = "[A-Za-z0123456789_./-]*";I tried to place \s but \s includes other whitespaces characters.
I would like to include in my regex the \n character (the Enter button) or general the \s characters.
How am i supposed to do that?
Thanks, in advance!

g_p_java wrote:
prometheuzz wrote:
>
Note that on Windows, a line break is "\r\n".
Also, A-Za-z0123456789_ can be written as \w:
String regex = "[\r\n\\w./-]*";
If we are using Linux , Unix is that different?The OS line break is just \n. I'm not sure what Swing puts into a GUI element, whether it's OS dependent or not. It won't hurt you to leave the \r in there though. If there's no \r in the string, it won't stop your regex from working, just like it won't stop it from working when you have A-Z and they don't happen to enter a Z.
The only way it would cause a problem to leave the \r in the regex is if \r were somehow part of the input and you didn't want it treated as end-of-line. I don't see that happening though.

Similar Messages

  • Question related to REGEX  functions

    Hi,
    I am working on Oracle 10gR2.
    I am working on a column which stores username. Let's say that one of the values in this column is "Ankur". I want to fetch all records where username is a concatenated string of "Ankur" followed by some numerical digits, like "Ankur1", "Ankur2", "Ankur345" and so on. I do not want to get records with values such as "Ankurab1" - that is anything which is concatenation of some characters to my input string.
    I tried to use REGEX functions to achieve the desired result, but am not able to.
    Can anyone help me here?
    Best,
    Ankur

    Her is one way.
    SQL> with sample_data as (
      2    select 'Ankur1' str from dual union all
      3    select 'Ankur2'  from dual union all
      4    select 'Ankur345' from dual union all
      5    select 'Ankurab1' from dual)
      6  select str from sample_data
      7  where regexp_replace(str, '[0-9]+$') = 'Ankur';
    STR
    Ankur1
    Ankur2
    Ankur345John

  • Basic question related to EKKO and EKPO

    Hi experts,
    I have invoice document header and line item data in an internal table(From RBKP and RSEG). From RSEG I have PO number(EBELN) and PO line item(EBELP).
    I want to find out the corresponding WBS element, costcenter and GL account of the PO number and the PO line item.
    Can anybody tell me which tables to select to fetch WBSelement(PS_PSP_PNR), glaccount(SAKNR) and costcenter(KOSTL).
    In which table I will find the link between EBELN,EBELP with KOSTL,SAKNR and WBS element?
    Regards,
    Sangeeta.

    SOLVED THE QUESTION MYSELF.
    THANKS EVERYBODY!!!

  • A workflow question relating to InDesign and LiveCycle

    Hi,
    I have a layout that I've created in InDesign CS3. I export the PDF from InDesign and open it in LiveCycle v8. I then build my form fields and save the PDF. I have my nice form to distribute.
    My question revolves around how to change the layout in InDesign and not lose all of the work done in LiveCycle. So let's say I want to change the background image for the form but not any of the form data. How can I export the new PDF from InDesign and merge it with the form fields from the original LiveCycle PDF?
    Many thanks,
    Ian P.

    You imported the PDF using "Create an Interactive Form with Fixed Pages" since Replace Artwork is not available with "Create an Interactive Form with a Flowable Layout".
    Please keep in mind, you can only replace artwork which has the same number of pages and identical page sizes as the original. If you change either of these in InDesign, you will have to copy/paste from one document to another.
    John

  • Is there a dedicated area to ask questions related to netbeans and VWP ?

    Hi All,
    Here is a site we developed using Creator : https://www.focalpointfurniture.co.uk/shop/
    We are now looking at using Netbeans to develop visual web applications but are having a lot of issues with layout and css. Any ideas where to ask and answer questions ?
    Regards
    Jim
    Message was edited by: Jim
    jimmymac

    Hello,
    Checkout the following link:
    http://www.nabble.com/Visual-Web-f24578.html
    You can also email [email protected]
    Hope that helps.

  • Question related to GetFile and GetPath of a URL

    Hello, i have the following code and i was wondering why GetFile and GetPath shall return the same output,
    e.g. my example here is http://wikis.sun.com/display/SunForums/Tips
    The GetPath returns : Get Path of URL /display/SunForums/Tips
    and the GetFile returns : Get file of URL /display/SunForums/Tips
    the same.
    Well it's just that i would like to use a method which is going to output only the File of a Path, in our example the output should be only Tips.
    CODE :
    import java.io.BufferedReader;
    import java.io.FileNotFoundException;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.net.*;
    public class Main {
        public static void main(String[] args) throws MalformedURLException, IOException, Exception {
                        BufferedReader in = null;
                       try {                              //try
                              URL yahoo = new URL("http://wikis.sun.com/display/SunForums/Tips");
                             String url_string = yahoo.toString();  // Constructs a string representation of URL
                             URLConnection yc = yahoo.openConnection(); //
                             in = new BufferedReader(new InputStreamReader(yc.getInputStream()));
                             System.out.println("Get file of URL " + yahoo.getFile());                            *//it should return only Tips*
                             System.out.println("Get Path of URL " + yahoo.getPath());
                              catch (MalformedURLException ex) {
                                                                                  System.err.println("MalformedURLException" + ex);
             }Is there any method which returns only the file of a URL?
    Thanks in advance!

    new File("/display/SunForums/Tips").getName() will return "Tips".

  • A sample question related to FMS and NetStream.. hoping your answer

    will i be able to send a video what i'am receiving form fms B to another fms A in a flash app?And how?
    i will be right here waiting for your answer. Thank you!!!

    Hello,
    thanks fo your help very much.
    your solution works well in sending a video from fms A to fms B.but it is unable to work in my network environment.
    in my network environment,fms A can not connect to fms B directly,but flash clients can connect to them directly both.
    i still need a kind of flash client that sending out video stream to fms B while it receiving stream form fms A.
    i means that i want to use flash client as a bridge.
    if you make a change from "A.Live Video B.Server 1 (New York City) C.Server 2 (Chicago) and Server 3 (Los Angeles) D.Users" to "A. Live Video B. Server 1 (New York City) C. Users D. Server" in http://help.adobe.com/en_US/FlashMediaServer/3.5_Deving/WS5b3ccc516d4fbf351e63e3d11a0773d5 6e-7ffb.html is what i really want .
    thanks for your help again!

  • Small question related to Unix and ABAP

    Hi Guys,
    I had a new SAP ABAP requirment in which they are asking for unix shell scripting.
    I am just wondering as what unix shell scripting has to do in SAP ?
    Please throw some light on this....
    Regards,
    Tushar.

    Hi Tushar,
       Please Close your previous thread by marking helpful answers...
    for this question ...
    Check these links out
    monitor ABAP from UNIX
    Re: execute unix in ABAP
    Unix commands in ABAP
    Download to Unix
    these Links definitely find helpful to you...
    Regards,
    Santosh

  • Questions related to SMC and firmware update

    In 2005 just before Tiger OS was launched, I purchased the iMac G5 which was introduced in Oct, '04. This is a 1.8GHZ-17inch iMac, and I would like to find out if there is any firmware that need to be updated.
    I tried to reset the SMC - shut the computer, unplug power for 15 seconds, restart - and have not noticed any changes with the malfunctioning sleep function. When I click it to sleep it immediately shuts the system off.
    I can't determine if this is caused because I never have updated the firmware, or because the SMC needs to be reset.
    Would any required firmware update would also show when I run the update software application? If not, how can I find out if any firmware for the iMac model needs to be updated?
    To reset the SMC for some computers one needs to open the system and reset a button in the motherboard. I don't wan't to do that unles I need. I also need to know where the reset button is located.
    Your help and/or comments are appreciated.

    I'll second that -- everything sounds normal -- Mac's just run hotter at times -- in real-life use, you will probably find it doesn't get that hot. Those tests are literally for the birds. Too many people in these forums give too much bad advise, and it leads to people being worried about nothing.
    In general, you will do better with chat forums in other sites, rather than this help forum, because 99 percent of the people who post here are those who have some kind of problem, and rather than going to their apple store, they post and post their problems over and over here (and other sites).
    The likelihood of you having any real-world problems are pretty much nil.

  • Can someone plz confirm me that how i can change or update the security questions related to my apple id? as i have been never put them since i create my apple id but now due to some security reasons its asking me again and again the answers. i am unable

    can someone plz confirm me that how i can change or update the security questions related to my apple id? as i have been never put them since i create my apple id but now due to some security reasons its asking me again and again the answers. i am unable to go through the process. thanks.

    Some Solutions for Resetting Forgotten Security Questions: Apple Support Communities

  • Questions on StringTokenizer, trim(), and parsing.

    im doing an assignment that requires parsing and havent had that much practice with parsing regular text from a file, ive been doing mostly parsing from a html. my question is if im parsing a line and i need 2 different types of information from it, should i just tokenize it twice or do it all at once, assuming the text format is always the same. for example
    String input= "this is a test[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]";if parsed correctly with StringTokenizer it would be 4 Strings(this is a test) and 10 ints for the countdown of numbers. now since the Strings doesnt have a delimiter such as a comma i can use the default delimiter which is the whitespace but then would that mean i would have to parse that same String twice since the numbers has "," has a delimiter? also should i worry about the whitespace that is separating the numbers after the comma? i did a small driver to test out the trim() using this and both outputs were the same. this may be a dumb question but if i call the trim() it eliminates the white space right, therefore i can just set "," as my delimiter, question is why is my output for both Strings the same?
        String input= "this is a test[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]";
        String trimmed = test.trim();
        System.out.println(input);
        System.out.println("\n" + trimmed);SORRY if its confusing im trying not to reveal too much of the hw assignment and just get hints on parsing this efficiently. Thanks in advance

    similar example on how to parse out the numbers with
    "," as a delimiter. thanks in advanceThe following is a simple recursive descent parser to parse a comma delimited list of numbers "(1, 2, 3, 5, 6)". The grammar parser by this code is
    START -> LPAREN LIST RPAREN
    LIST -> NUMBER TAIL
    TAIL -> COMMA LIST | LambdaThe nonterminals NUMBER, LPAREN, RPAREN, and COMMA are defined by the regular expressions in the code.
    Lexical analysis is done by the function advanceToken(). It stores the next token in the variable "lookahead" for further processing. The parse tree is represented recursively through the functions start(), lparen(), rparen(), list(), number(), tail(), comma(), which match the corresponding symbols in the grammar. Finally, translation is done in the function number(). All it does is put the numbers it finds into the List intList. you can modify it to your needs.
    This code originally parsed simple arithmetic expressions, but it took only ten minutes to parse lists of integers. It's not perfect and there are several obvious improvement that will speed up performance, however the strength of the design is that it can be easily changed to suit a variety of simple parsing needs.
    import java.util.regex.*;
    import java.util.*;
    public class RDPParenList {
        private static final Pattern numberPat=
                        Pattern.compile("([1-9]\\d*)|0");
        public static final Object NUMBER = new Object();
        public static final Pattern commaPat = Pattern.compile(",");
        public static final Object COMMA = new Object();
        public static final Pattern lparenPat=
                        Pattern.compile("\\(");
        public static final Object LPAREN = new Object();
        public static final Pattern rparenPat=
                        Pattern.compile("\\)");
        public static final Object RPAREN = new Object();
        public static final Token NULLTOKEN = new Token(null, null);
        String input;
        String workingString=null;
        Token lookahead=NULLTOKEN;
        List intList = new ArrayList();
        /** Creates a new instance of RecursiveDescentParse */
        public RDPParenList(String input) {
            this.input=input;
        public void parse(){
            workingString=input;
            advanceToken();
            start();
            if(! "".equals(workingString))
                error("Characters still remaining in input '" + workingString + "'");
        private void advanceToken() {
            // calling advanceToken must give a token
            if("".equals(workingString))
                error("End of input reached unexpectedly");
            // prune the old token, and whitespace...
            if(lookahead != NULLTOKEN){
                int cutPoint = lookahead.symbol.length();
                while(cutPoint < workingString.length() &&
                        Character.isWhitespace(workingString.charAt(cutPoint))){
                    ++ cutPoint;
                workingString=workingString.substring(cutPoint);
            // Now check for the next token, starting with the null token...
            if("".equals(workingString)){
                lookahead=NULLTOKEN;
                return;
            Matcher m=numberPat.matcher(workingString);
            if(m.lookingAt()){
                lookahead=new Token(m.group(), NUMBER);
                return;
            m=commaPat.matcher(workingString);
            if(m.lookingAt()){
                lookahead=new Token(m.group(), COMMA);
                return;
            m=lparenPat.matcher(workingString);
            if(m.lookingAt()){
                lookahead=new Token(m.group(), LPAREN);
                return;
            m=rparenPat.matcher(workingString);
            if(m.lookingAt()){
                lookahead=new Token(m.group(), RPAREN);
                return;
            error("Error during lexical analysis. Working string: '" +
                           workingString + "'");
        private void start() {
            lParen(); list(); rParen();
        private void lParen(){
            if(lookahead.attrib == LPAREN){
                advanceToken();
                // OK. Do nothing...
            else error("Error at token '" + lookahead.symbol + "' expected '('");
        private void rParen(){
            if(lookahead.attrib == RPAREN){
                advanceToken();
                // OK. Do nothing...
            else error("Error at token '" + lookahead.symbol + "' expected ')'");
        private void list() {
            number(); tail();
        private void number() {
            if(lookahead.attrib == NUMBER){
                // Do something with the number!
                try{
                    intList.add(new Integer(lookahead.symbol));
                catch(NumberFormatException e){
                    // This shouldn't happen if the lexer is working...
                    e.printStackTrace();
                    error("Unknown Error");
                advanceToken();
            else error("Error at token '" + lookahead.symbol + "' expected a number");
        private void tail() {
            if(lookahead.attrib == COMMA){
                comma(); list();
            else {
                // Lambda production
        private void comma() {
            if(lookahead.attrib == COMMA){
                advanceToken();
                // OK. Do nothing...
            else error("Error at token '" + lookahead.symbol + "' expected ','");
        private void error(String message){
            System.out.println(message);
            System.exit(-1);
        public static class Token{
            public Token(String symbol, Object attrib) {
                this.symbol=symbol;
                this.attrib=attrib;
            public String symbol;
            public Object attrib;
        public static void main(String []args){
            if(args.length == 0)
                return;
            System.out.println("\nParse String: " + args[0]);
            RDPParenList p=new RDPParenList(args[0]);
            p.parse();
            System.out.println("OK!");

  • Question related to Java Concurrent Program

    Hi Friends,
    I have a basic question related to Java Concurrent Program in the Oracle application. I would like to know the how Java concurrent program is executed in Oracle applications.Also, want to know where can I find the document for the AOL packages for Java concurrent program. Document for packages like oracle.apps.fnd.cp.request.* , oracle.apps.fnd.util.*.
    Please let me know.
    -Thanks,
    Satya

    You may also check:
    Note: 250964.1 - How to Register Sample Java Concurrent Program
    https://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=250964.1
    Note: 186301.1 - How to register and execute Java Concurrent Program ?in Oracle Applications R11i?
    https://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=186301.1

  • Basic questions about Bigdata, NOSQL and Hadoop

    Hi,
    I've basic questions related to Bigdata. (I've googled it but still wants to confirm with experts)
    Please correct me if I am wrong on below.
    1) As far as I know big data is collection of unstructured data. Even we can store relational data as well.
    2) NOSQL is an Oracle product to handle bigdata (un structured data and relational data as well)
    3) Hadoop is the only one frame work which is avilable in market to manage the bigdata.
    What are the other database systems we have in the market to manage the bigdata.
    Cheers,
    Suri

    Hi Suri,
    1)  "Big Data" does not have a crystal clear, black and white definition. 
    It is generally characterized as being the processing and management of an amount and type of data that makes a specific workload on that data slow and/or expensive.
    Most commonly, Big Data involves processing and management of unstructured data of large volume and the typical technology used to store/process it is Hadoop, However, on occasion a NoSQL database will also deal with unstructured data.
    Big Data is also seen often in the form of simple, semi-structured data of both large volume and/or large velocity and the typical technology used to store/process it is a NoSQL database.  However, on occasion Hadoop will also deal with semi-structured data of large volume.
    In some cases, Big Data is seen in the form of highly connected data that will be manipulated by advanced algorithms that will need to touch a lot of the data and the typical technology used to store/process it is a Graph type of NoSQL database.
    2)  NoSQL is a category of database technologies most often dealing with the issues as outlined in bullet 2 above.   The Oracle NoSQL Database is oracle's product in the NoSQL category of database technologies.   It does NOT store relational data.   When using NoSQL relations between the data must be managed within the application code.
    3)  Hadoop and NoSQL booth manage Big Data, but different aspects as discussed in (1) above.   Hadoop is a batch based, slow processing data technology, but the "slow" is relative because it can process very large amounts of data, so minutes is commonly seen as fast.   NoSQL is a near real-time data processing technology and typically deals with Big Data where access times are in the single digit millisecond range.
    Hope this helps,
    -Robert

  • Interview Questions related to Warehouse management

    Hi all
    Can u please help me regarding  Interview Questions related to Warehouse management
    Thanks and Regds
    Daniel

    Have you searched in very first thread
    [Warehouse Management?|New to Materials Management / Warehouse Management?;

  • Table Relation with Payment and Invoice of Vendor

    Hi all,
         I have one question about Table Relation with Payment and Invoice of Vendor.
         the scenario is.
         2 Purchase Order number : 100000001/100000002
         1 Invoice document number : 200000001 which include  2 Purchase Order.
         1 Payment document number : 300000001
         How should I found out table relation from Payment document number - Invoice document number - Purchase Order number. ?
          I try to link the following table, but it does not work.
          RBKP     *     Invoice Receipt
          RSEG     *     Invoice Receipt document line item
          BKPF     *     Accounting Document Header
    BSEG     *     Accounting Document Segment
    PAYR          Payment Medium File
    BSIK          Accounting: Secondary Index for Vendors
    BSAK          Accounting: Secondary Index for Vendors (Cleared Items)
    BSIS          Accounting: Secondary Index for G/L Accounts (Open Items)
    Does any one know about it ?
    Regards
    KY Chuang

    Hi Venkatesh,
    Thnx a lot for the reply. This has almost solved my problem, however there's one thing left. when I'm trying to take a print out after exporting the info into an excel sheet, the information really looks scattered, i.e.,  is there a way where we can go ahead and get the info in a rather unscattered manner.
    I've tried to take a print directly without actually transferring the info into an excel sheet, then each of the vendor is printed in a separate page, which again they feel is a problem.
    So, if you have an idea pls suggest.
    Thnx again for the information.
    regards
    sandhya

Maybe you are looking for

  • Is there any way to prevent Aperture from Auto Cropping an image?

    Is there any way to prevent Aperture from auto cropping an image? I use the "Do Not Crop" aspect ratio often and Aperture constantly picks cropping aspects for me, which is driving me crazy. Can I set "Do Not Crop" as the ratio I want on a more perma

  • What is the best way to improve export time in PreE10?

    I import the mts files directly from a sd card or HDD using PreE10's importer. Next, I add titles, video/audio fades, and transitions then export to DVD. Right now, my projects are 60min+~4min black video in length and exported directly from PreE10 a

  • Variable passed in movie param

    I am having a troublesome issue that seriously affects a paying client. Any help is greatly appreciated. 1. Built a FLASH 8 movie that has three frames. Each Frame is a single form. 2. The movie param lists the SWF followed by a single parameter (<pa

  • Reg: Vendor Account Group Number Range

    Hi Guru's,   I have created 3 Account groups for vendor - MV- Material Vendor , SV - Service Vendor , Ov - One Time Vendor And i need to number range (external) like this for MV- MV10000 to MV19999 and SV - SV10000 to SV19999 i tried by XKN1 but the

  • Actual cost calculation

    Dear All How can i find the actual cost in subcontrating cycle for my consumed materials Regards