Another question about regular expressions with String.matches

don't match String.matches () method expressions when a substring of the string matches, or must match the whole string? So if I have the string '123ABC', and I ask match "1 or more letters" will be it fail because there are other that the letters in the string, but then spend if I add "1 or more letters AND numbers 1 or more? Thus, in the second case each character in the string is recorded in the research, as opposed to the first. Is that correct, or are there ways to JUST matching a substring in the string instead of all this? I'll do some examples too... but that makes sense?

It must match the entire string. Use Matcher.find () to match on just a sub-string)

Tags: Java

Similar Questions

  • Yet another question about the update with the shutters tab

    I am quite new to this, but I've been scouring the boards and try many different things, and I decided to ask for advice.

    There are other threads similar to my problem such as:

    http://supportforums.BlackBerry.com/T5/Java-development/SetFocus-issue-with-tabbed-screen-page/m-p/6...

    http://supportforums.BlackBerry.com/T5/Java-development/how-to-delete-a-Manager-or-a-field-that-is-c...

    I have a set up tabbed pane based on the example and everything works fine until I have delete a line from a VerticalFieldManager. It is by default the focus on the first item on the screen, and I get this. My problem is trying to substitute or replacement behavior.

    My screen implements the FocusChangeListener for the buttons on the tab (custom LabelFields).

    I tried many different variations - I tried to manage the update completely manual and ended with a bit of a mess. I tried to capture the event navigationUnclick() and coding of the focusChanged() method to manually switch the update, but it seems that the focusChanged() method is called before the focusChanged(), which doesn't help me.

    As I said I am pretty new to this so I could do something very stupid, but I don't really understand the focus handling implementation. A kick in the right direction would be appreciated.

    Thank you.

    You can have a NullField in your managers before all other areas - in this way, even if you delete the rest, the NullField might keep the focus.

    If this does not help, try the substitution of sublayout for your managers, call super.sublayout and then explicitly setFocus to your NullField (the deletion of any field causes a display Manager to rearrange).

  • I'll try to find the right forum to ask questions about Outlook Express 6

    I'll try to find the right forum to ask questions about Outlook Express 6

    XP: Networking, Mail & onlinehttp://social.answers.microsoft.com/Forums/en-US/xpnetwork/threads Bruce Hagen MS - MVP [Mail]

  • I read this topic (I have a lot of questions about Xperia Z2 with lollipop)

    Hello world. I read this topic (I have a lot of questions about Xperia Z2 with lollipop) and I have posted a question, but it seems that no one saw him. That means the following: (how can I install the source application unknown to other users in my phone because it is to the unknown source menu is disabled in the settings-> Security)? This means that I can not install all the apps if I switch to the lollipop? Can someone tell me please the exact meaning of this?

    Thank you.

    It's true, but game store will not need this option checked - loading of a file manager will - but which is not say that the application will work once installed

  • "Matches regular Expression" and "Model match" vi behaves differently

    Hello

    I need a simple matching chain and experimenting that found the "Regular Expression Match' and 'Correspondence model' vi behave a little differently. I guess that the entries of the regular expression on the two the same behavior. It's a difference that I discovered that the "|" character ("vertical" character, commonly used as an operator 'or') is recognized as such in the regex to Match vi, but not in the match vi model (where it is taken to the letter). Furthermore, I can't find any document using (online or in LabVIEW) on the ' | ' usage in regular expressions of character. Is - this documented anywhere?

    For example, suppose I want corresponding to one of the following 4 words: 'The' or 'fast' or 'brown' or 'fox '. The regular expression ' the | fast | Brown | Fox' (without the quotes) works for the vi Regular Expression Match but not the match pattern vi. Here is a photo of the block diagram and the results of the façade:

     

    The Help explains that the vi Regular Expression Match performs a little more slowly the match vi pattern, so I started with the latter. But since he does not work for me, I'll use the old. But does anyone have an idea of the speed difference? I guess that's negligible in a simple example.

    Thank you!

    Thank you, Jeff. That's what I was looking for. BUT my version of LabVIEW 8.5, does NOT say "functionfor example, the Match model does not support the parenthesis or vertical bars (|) characters.«» !

    See: http://zone.ni.com/reference/en-XX/help/371361D-01/glang/match_pattern/

    and http://zone.ni.com/reference/en-XX/help/371361D-01/glang/match_regular_expression/

    It is not mentioned in the help of special characters used for the match pattern : http://zone.ni.com/reference/en-XX/help/371361D-01/lvhowto/specialcharformatchpatt/

    The only place | has 'talked', it is in the sentence: "some regular expressions that use alternating (such as (. |))". \s)*) require significant resources to deal with when it is applied to the large input strings. "But I'm not processing a large chain.

    It seems that NEITHER fixed this omission. What version is your help?

    Ed

  • A question about external authentication with PHP OCI8 using a portfolio store

    Hello
    SQL> SELECT * FROM v$version;
    
    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE     11.2.0.1.0     Production
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    
    SQL> 
    OS: Linux Fedora Core 17 (x86_64)
    PHP Version: 5.4.14
    Apache version (httpd): Apache/2.2.23 (Fedora) 
    I have a question about OCI8 connection to the Oracle server via portfolio, which I understand is a good practice because we do not have to hard code the users password. I'm trying to read pages 117 and 118 of the book The Underground PHP and Oracle manual online to learn how to set up a portfolio. I proceeded by steps as explained in these two pages (except that at the end I connect, as a normal user, not a privileged user) yet, apparently PHP does not detect the user.

    Here's what I write in my script
    $connection = 
                    oci_connect 
                        (
                            "training", 
                            "", 
                            "php_ora_usr", 
                            "AL32UTF8"
                        );
    the training is the name of the user that I use in my PHP scripts to connect to the oracle database and the password is mypassword (is not true, just for the purpose of this thread :)) the code above gives me the following error:)
    Warning: oci_connect(): ORA-01005: null password given; logon denied in /var/www/html/myscript.php on line 91
    
    Fatal error: Connection step: ORA-01005: null password given; logon denied in /var/www/html/myscript.php on line 13
    But if I also provide the password which is,
    $connection = 
                    oci_connect 
                        (
                            "training", 
                            "mypassword", 
                            "php_ora_usr", 
                            "AL32UTF8"
                        );
    Obviously it works, but at the same time, this means that my wallet is not operational.

    So I'll write here, step by step, how I did according to the instructions contained in the pages 117 and 118 of the above mentioned book and I would be grateful if you could kindly tell where I made the mistake (s)

    The following text was performed under my oracle linux (so the dbagroup)

    Step 01:_
    I created and provided the password for the directory of portfolio
    mkstore -wrl /home/oracle/wallet_dir -create
    Step 02:_
    I created an entry for my oracle user that will be used in my PHP scripts to connect to oracle
    user: training
    password: mypassword
    mkstore -wrl "/home/oracle/wallet_dir" -createCredential php_ora_usr training mypassword
    I also checked that the entry was actually created for my user in the portfolio
    $ mkstore -wrl "/home/oracle/wallet_dir" -listCredential
    Oracle Secret Store Tool : Version 11.2.0.1.0 - Production
    Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved.
    
    Enter wallet password:                
       
    List credential (index: connect_string username)
    1: php_ora_usr training
    $ 
    Step 03:_
    I added the following to my $TNS_ADMIN/tnsnames.ora
    .  .  .
    php_ora_usr = 
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = db02)
        )
      )
    .  .  .
    Step 04_
    I added the following to my $TNS_ADMIN/sqlnet.ora
    # sqlnet.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/sqlnet.ora
    # Generated by Oracle configuration tools.
    
    NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
    
    ADR_BASE = /u01/app/oracle
    
    WALLET_LOCATION =
        (SOURCE =
            (METHOD = FILE)
            (METHOD_DATA =
                (DIRECTORY = /home/oracle/wallet_dir)
            )
        )
    SQLNET.WALLET_OVERRIDE = TRUE
    SSL_CLIENT_AUTHENTICATION = FALSE
    SSL_VERSION = 0
    _ Step 05
    The TNS_ADMIN environment variable is already set correctly in * / etc/sysconfig/httpd * so I didn't need to do something for this step


    Step 06_
    I gave to access Apache (as root) in the directory of portfolio (in fact, it seems that the user oracle (dba) of linux also has the required privileges to grant this access to the apache)
    # setfacl -m u:apache:rx /home/oracle/wallet_dir
    # setfacl -m u:apache:r /home/oracle/wallet_dir/{cwallet.sso,ewallet.p12}
    Step 07_
    Restart Apache
    # service httpd restart
    Step 08_
    Finally make a test connection using the connection string php_ora_usr which the entry was created earlier. And the test was not successful, as indicated above
    $connection = 
                    oci_connect 
                        (
                            "training", 
                            "", 
                            "php_ora_usr", 
                            "AL32UTF8"
                        );
    The error message:
    Warning: oci_connect(): ORA-01005: null password given; logon denied in /var/www/html/myscript.php on line 91
    
    Fatal error: Connection step: ORA-01005: null password given; logon denied in /var/www/html/myscript.php on line 13
    I would appreciate it if you could kindly shed some light.

    Thanks in advance,
    Dariyoosh

    That gives a good clue to begin with. With your platform/Apache/DB, you might need different ACLs. Test directory and permissions. Check what euid your Apache runs as. Good luck.

  • regular expression or string (nevermind) format

    Resolved,

    I can use the string to a fractional number!

    Hello

    I have an array of strings in a multicolumn list box 2D, and I want to check if each value is a valid number, numbers can be one and can have negative values. Anyone know what regular expression, I need to check it out, or there at - it a still better way?

    Best regards

    Thijs

    solved!

  • problem of regular expression with brackets

    Hello

    I have a Zebra printer string that contains tokens that I want to search.

    ^ BY2, 3, 55 ^ FT50, 219 ^ BCN, Y, N... ^ FD >: [[number 1]] ^ FS
    ^ BY2, 3, 55 ^ FT525, 221 ^ BCN, Y, N... ^ FD >: [[serial number 2]] ^ FS
    ^ FT170, 192 ^ XG000. GRF, 1, 1 ^ FS
    ^ FT220, 430 ^ A0N, 27, 27 ^ FH\ ^ ea FD2. #00931 drum kit / ^ FS
    ↑ FT350, 460 ^ A0N, 27, 27 ^ FH\ ^ FD #00602 ^ FS
    ^ FO10, 32 ^ GB780, 480, 8 B, 1 ^ FS
    ^ FT720, 500 ^ A0N, 10, 10 ^ FH\ ^ FD [[Date Code]] ^ FS

    I want to find any instance of double hooks regardless of the bracketed text. I find [[SerialNumber 1]] for example, but I also want to analyze the entire string and ensure that there no case [[text]] left in the string. I was not able to build a regular expression that will find them.

    Hi elrathia,.

    Please find below screenshot

    Kind regards

    SrikrishnaNF

  • Question about streaming video with FMS3 live

    Thanks much for you efforts...
    I tested an exciting tutorial about streaming video with Flash Media Server 3.5 live...
    every thing went good and I could see my webcam broadcast from my computer via my web site, but unfortunately I see no any other machine

    I use Microsoft windows XP SP2
    and flash media live encoder 3
    but my UNIX web server
    is this a problem?
    Please send me your comments if its possible
    Thank you very much

    Replace localhost with the public ip address of the computer running FMS then paste the SWF on the Web server and mean it... will work, provided you rtmp string points to the computer running FMS

  • Evaluation of the regular expression with logical operator

    Hi all

    I am little confused with expression with logical operator evaluation. I'm trying to understand the in expression.

    -----
    eXa.getTrue () & & eXa.getFalse () | eXa.getFalse () & & eXa.getTrue () | eXa.getFalse () is false and True Count: 1 False Count: 3

    According to the agreement, it should be true with True Count: 1 False Count: 3
    It must run the 1 getTrue() then 1stGetFalse() and getfalse() then 2nd jump 2nd getTrue() and must run 3rd fetFalse()

    -----
    eXa.getTrue () & & eXa.getTrue () | eXa.getFalse () & & eXa.getTrue () | eXa.getFalse () is true and true count: 2 False Count: 0

    According to the agreement, it should be true with True Count: 3 False Count: 0
    He must run getTrue() 2 1 1 getFalse() jump and run 3rd getTrue() and jump the last getFalse().

    -----
    eXa.getTrue () | eXa.getFalse () & & eXa.getFalse () | eXa.getTrue () & & eXa.getFalse () presents itself as true and true count: 1 False Count: 0

    According to the agreement, it should be true with True Count: 2 False Count: 2
    It must run 1 getTrue() and jump getFalse() 1st run 2nd getFalse() and then run getTrue() 2nd and 3rd then getFalse()

    Please, help me understand above expressions.


    Here is the definition of methods:

    Private boolean getTrue() {}
    trueCount ++;
    Boolean retrunValue = 4 > 3;
    Return retrunValue;
    }

    Private boolean getFalse() {}
    falseCount ++;
    Boolean retrunValue = 3 > 4;
    Return retrunValue;
    }


    Thanks for your help

    >

    added parentheses to make order of the most obvious BSP. adding a "?" to show calls not executed.

    (eXa.getTrue() && eXa.getFalse()) || (eXa.getFalse() && eXa.getTrue()) || eXa.getFalse()  comes as false and True Count: 1 False Count: 3
    
    (T && F) = F
    (F && ?) = F
    (F) = F
    
    F || F || F = F
    
    (eXa.getTrue() && eXa.getTrue()) || (eXa.getFalse() && eXa.getTrue()) || eXa.getFalse()  comes as true and True Count: 2 False Count: 0 
    
    (T && T) = T
    (? && ?) = ?
    (?) = ?
    
    T || ? || ? = T
    
    eXa.getTrue() || (eXa.getFalse() && eXa.getFalse()) || (eXa.getTrue() && eXa.getFalse())  comes as true and True Count: 1 False Count: 0
    
    (T) = T
    (? && ?) = ?
    (? && ?) = ?
    
    T || ? || ? = T
    
  • Another question about Dates

    Hi, I have another question regarding the use of the field date in Adobe Designer 8.  I have the updated domain in place so that the person can enter the date, lets say, 12/12/11 and it will convert to December 12, 2011, or, the user can click on the calendar that is attached to the date field and make a date selection.  My question is this.  Is there a way that can not only the calendar go to any date by selecting < or >, but can also go to an exercise < < or > >?  We have contracts that extend from 2 to 3 years and want this option to be available.

    Thanks for any help you can provide.

    Here is how I currently have my date fields in place.

    In the field section:

    View model: MMMM D, YYYY

    Edit pattern: M-D-AA

    Section of the value:

    MMMM D, YYYY

    Date must be entered as per example, 12 January 2012

    Liaison section:

    MMMM D, YYYY

    The calendar widget allows you to select other years.

    When you open the calendar, click on the name of the month, the calendar will show you every month of the current year.

    When you then click on the year, it shows you all the years of the current decade.

  • Another question about printing with Adobe Reader 10.1.2

    I use Adobe Reader with Windows 7 (32 bit) 10.1.2 to print on my HP Officejet 6000 and was very happy to see that she is automatically printed on both sides of the paper and paused to give clear instructions on how to reload the paper to print on the other side, and everything worked fine. Until one day, with the same settings (unless I accidentally hit something) printing returned to his old ways: Although the dialog box print on both sides of the selected paper, it print on one side. I resorted to the ancient practice of trick the printer by limiting the paper, then when he expired, put in the pages had been printed on one side, to print on the other.

    How can I restore drive 10.1.2 to his original behavior?

    It might be the setting of the printer was set to ensure that duplex printing is more would be and its replacing the printer dialog box settings.

    The printer, check to make sure that duplex printing is turned on.

  • Questioning REGEXP_SUBSTR, regular expressions

    With the expression below, I expect to come back the first 4 words and do not understand why it is not doing.

    db > select regexp_substr('This is a sample text string', '([[:alpha:]]+){3,4}') from dual;
    REGE
    ----
    This
    

    This works as expected.

    db > select regexp_substr('This is a sample text string', '([[:alpha:]]+ ){3,4}') from dual;
    REGEXP_SUBSTR('TH
    -----------------
    This is a sample
    

    Hello

    Solomon Yakobson says:

    Frank Kulash wrote:

    If you are looking for 3 or 4 instances of 1 or more letters, without anything in addition to the letters between them.  Any group of 3 or more consecutive letters matches.  For example,.

    1. "Th" as the 1st appearance of 1 or more letters,
    2. 'i' as the 2nd appearance of 1 or more letters, and
    3. of ' as the 3rd appearance of 1 or more letters

    is a substring that matches the pattern you described.

    In fact T is the 1st appearance of 1 or several letters, h is the second, I ranked third and s are defined. Otherwise:

    SQL > select regexp_substr ('the following is an example of text string', ' ([[: alpha:]] +) {3,4}') of the double
    2.

    REG
    ---
    The

    SQL >

    returns no rows.

    Not that it is important for the OP's question, but I think the way I presented it is more precise.

    How can tell us if 'This' match of the 4 occurrences (all 1 character) or 3 occurrences (1 with 2 characters and 2 with 1 character each)?

    In more general terms, when we say something like

    (expr +) {x, y}

    is '+' more greedy than "{x, y}.

    It seems to me that '+' is dishonest in this case.  Consider this query:

    WITH sample_data AS

    (

    SELECT "This is an example of text string" dual UNION ALL STR

    SELECT 'the following is an example of text string' FROM dual UNION ALL

    SELECT 'Fubar' double UNION ALL

    SELECT 'chat' FROM dual

    )

    SELECT str

    REGEXP_REPLACE (str

    , ' ([[: alpha:]] {1,2})([[:alpha:]]+) ([[: alpha:]] +)([[:alpha:]]+)?'

    , "\1=1;\2=2;\3=3;\4=4".

    ) And matches

    OF sample_data

    ;

    which produces this output:

    STR MATCHES

    ------------------------------------- ------------------------------

    This is an example of text string Th = 1; i = 2; s = 3; = 4 is a samp = 1; l =

    2; e = 3; 4 = = you 1; x = 2; t = 3; = 4 = stri

    1; n = 2; g = 3; = 4

    The following is an example of text string T = 1; h = 2; e = 3; = 4 followi = 1; n = 2; g

    = 3 ; = 4 is a samp = 1; l = 2; e = 3; = 4 t

    e = 1; x = 2; t = 3; = stri 4 = 1; n = 2; g = 3;

    = 4

    Fubar Fub = 1; a = 2; r = 3; = 4

    cat                                  c=1;a=2;t=3;=4

    In this case, '+' appears to be labels as "{3.4}.

    I don't have not seen this documented anywhere, but it seems it's because + gets to go first in the model.  In other words, there is nothing to inherently rapacity on ' + '.  If we change the first '+' above "{1,9}", like this

    WITH sample_data AS

    (

    SELECT "This is an example of text string" dual UNION ALL STR

    SELECT 'the following is an example of text string' FROM dual UNION ALL

    SELECT 'Fubar' double UNION ALL

    SELECT 'chat' FROM dual

    )

    SELECT str

    REGEXP_REPLACE (str

    , ' ([[: alpha:]]{1,9}) ([[: alpha:]] +) ([[: alpha:]] +)([[:alpha:]]+)?'

    , "\1=1;\2=2;\3=3;\4=4".

    ) And matches

    OF sample_data

    ;

    the result remains the same.

    Of course, is using the first query I posted above

    (expr) (expr) (expr) (expr)?

    It is possible that

    (expr) {3,4}

    which is what OP posted, is handled differently.

  • Questions about regular maintenance of the supply service

    Hi - today I received the notice on the subject of the thread - rss health acrobat upcome scheduled maintenance of the supply service.

    A few questions:

    (1) how many times must we expect it in regular maintenance that interrupts the service?

    (2) can ask us, the users, that scheduled maintenance will be moved to less awkward hours? 5 19:00 PST is listening for our company (we do therapy online course, and a lot of people looking our service once they get off work for the day).

    Thank you

    Chris

    Hi Chris,

    (1) majority of our maintenance - as this one night, what happens once a month, without interruption of service maintenance.  An existing session can get an auto-reconnect, but it should be transparent to the end user.  With the health page, our goal is to communicate more, but put you up a good point here, as the ad seems more worrisome than what I have described.  I'll take action to discuss with our operations team, so we are clearer about the experience expected in the future.

    Every now and then, we will need a maintenance resulting in downtime.  And when that happens, explicitly indicated us on the health page and are designed to achieve these during low traffic hours.

    (2) the current offer today Adobe is a service of several tenant, and unfortunately, it is impossible to find a time that works perfectly for all our customers.  At the end of the day, without interruption of service for all maintenance is our goal.  If you need something that is more suited to your needs, the good news is that we now have a partner who can offer the ACC as a single tenant with custom SLA.  If you are interested, please visit http://www.connectsolutions.com/products/lccs/.

    Thank you

    Fang

  • How I replace perfectly my record excel sheet with ability of database? + General questions about computing distributed with LabVIEW

    Surprisingly, I'm almost finished with a full blown control-simulation application, that I've been working on for more than a year now, thanks in no small part of this community. The final step is to run on the simulations of k ~ 8 and be able to meet a simulation and overall statistics on performance. Each simulation is taking about 6 minutes of real time to run (~ 2 seconds of real time per hour of simulation time, valid for 7 days of simulation), as we seek to about 800 hours of your time to simulate. I have 5 computers available and a raspberry 2 Pi these simulations on, I'm looking to set up a kind of compute cluster at the end in about 2 weeks.

    The ability of current logging is sketchy; I got about 40 columns of data, and they are written in a spreadsheet with a .xls format tabs-delimited. This works very well for individual simulations, but it would be quite heavy to deal with if I had more than 20,000 of them. I think this must be done with a relational database sort, but my experience with databases is very limited, especially then, when it comes to LabVIEW. Here are my questions:

    -Can I create a kind of master-slave configuration where a computer (and probably the Pi) keeps track of the simulations are complete, which are running, and who have never run? Computers slaves ask for simulation settings, and IP would give them to him.

    -How should I take care of the database? Each simulation is about 500 k in .xls format, it's about 5 GB of data in all. Computers slaves synchronization from time to time to take care of the redundancy?

    -How can I refine my memory + General fresh disk I/O? How can I know which items from my point of view most of them?

    -Do you have suggestions for the implementation of clusters of databases relational/computer with LabVIEW?

    I have attached a picture of my configuration of logging + the overall structure of the application. It is a state machine with a structure of the event for the interruptions.


Maybe you are looking for

  • Update has developed bad Bookmarks

    All was well with Firefox 11 this morning before his installation of an automatic upgrade. Now all bookmarks were lost. I tried to restore to an earlier date. Nada! The history is lost. I uninstalled and reinstalled Firefox. There is nothing. My addo

  • 1. to Stor.E TV - files are empty

    Hello I hope for your help. I have a 1 TB Store.E.TV. Attached to the PC, all the folders and files that I copied above appear. But when connecting to my TV, there is no more than all the files or folders are empty. Can please someone tell me where i

  • Tecra M2 PTM20E 'network controller' and pilots 'base system device '.

    Hello. I can't find drivers "network controller" and "base system device" Please tell me the exact name of the driver and the place for these drivers to download, I already checked under tecra M2 section but can't find any, please help. My operating

  • Update of the Macbook Pro 13 inch i7 (mid-2012) worm.

    Dear Apple community Greetings, I would like to know your opinion about the upgrade to the Macbook Pro 13 inch (mid-2012) i7 2.9 worm. by the following: 1. replace the stock HARD 750 GB to a Samsung EVO 850 SSD 1 TB drive in the link below cm_cr_pr_p

  • How can I return my computer to the factory setting.

    How can I return my computer to the factory setting.