Regex matches function

Hi
I am trying to come up with a regex that I can use with the matches function to validate the user id I accept. The user id can contain alphabets, numbers and 3 special chars ".","-" and "#".
The regex I came up with was: user_id.matches("[a-zA-Z\\d\\.\\-#]"). The string I am trying to match is 'user-1'. But this fails to match.
I am not confident about the regex I am using to match my string to. Please let me know what I am doing wrong.
Thanks

I would use '+' rather than '*'; I doubt that an empty string would be considered a valid user ID. ^_^   String regex = "[a-zA-Z0-9#.-]+";

Similar Messages

  • Using Match function in FR Reports

    Hi,
    Can anyone pls. let me know how i can use Match function in FR ? I've a Report where i'm using 2 Grids. In one Grid1 i'm using Entity under page and ICP dimension as Column. In Grid2, i'm using ICP under page and would like to use Match function where the condition is, if i select ICP member from Page, it should show the corresponding Entities in Grid1
    Thanks,
    PVR

    I don't think what your trying to do is available "out of the box", we have used a workaround to do what you want:
    - include idescendants for the member but apply suppression on the member names that ended in rollup.
    (we were lucky in that the parent members were standardized to contain rollup as the description name).
    Cheers, Iain

  • MATCH function support

    Hi
    I am having problems with the match function
    Basically I am using it to find the first and last position of a value in a range.
    =MATCH(B1,D5:D30,0)
    works fine to return the first value, but
    =MATCH(B1,D5:D30,1)
    to find the last value only works in the spreadsheet, not in the SWF.
    Anyone got any ideas?

    Ok, just be aware that countif can be a hit on performance so I would recommend only using it on small data sets.
    As for who to request this, thats a good question, you could raise a ticket with SAP via your Account rep, but other than placing the issue on here, I really don't know
    I'll check version 5.2 and 5.3 this evening an post the results on here.  Which version are you using?
    Edit:
    Version 5.2.0 and 5.3.0 have the same behaviour.
    Edited by: Charles Davies on Feb 1, 2010 6:36 PM

  • Question on regex Matcher (group number)

    HI, everybody
    I am writing a program on replacement like the one below.
    String regex = "(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)";
    String original = "ABCDEFGHIJKL";
    String replacement = "$12";
    Pattern p = Pattern.compile(regex);
    Matcher m = p.matcher(original);
    String result = m.replaceFirst(replacement);What I actually want is to take out the first group, in this case an "A", and append a character "2" after it.
    The result I am expecting is "A2". But the result I get is "L". For the regex engine takes it as the 12th group.
    What should I do to remove the ambiguity.
    Thanks.

    In such case, use $1\\2.

  • Capture regex match as a variable?

    Hello!
    I have this program and I basically want to match a part of a string and grab the match as a variable. In this case, the string I need to parse is 'foo'.
    Here is what I have:
    public class Test
         public static void main(String[] args)
                    // link <link> format
              String foo = "http://www.foo.com <http://www.foo.com>";
              String the_regex = "\\<(http://[^\\>]*)\\>";
              String the_replacement = "<a href=\"$1\">$1</a>";
              System.out.println(foo.replaceAll(the_regex,the_replacement));
    }$1 (sorta like PERL) should be the captured text from the_regex
    Any ideas?
    Thanks in advance.

    Dubwai - I think I got it, thanks for the guidance. Here is what I used, and it seems to work. Thanks!
    public class Test
         public static void main(String[] args)
              String foo = "http://www.foo.com <http://www.boo.com>";
              String regex="\\<(http://[^\\>]*)\\>";
           Pattern p = Pattern.compile(regex);
           Matcher m1 = p.matcher(foo);
           while (m1.find())
             System.out.println("The site = " + m1.group(1));
    }

  • I just subscribed to imatch while logged in to iTunes on a mac computer that belongs to someone else. (I was logged in to MY iTunes)  my iPhone will not turn on the MATCH function, saying I am no subscribed. I've powered off and on.  can anyone help?

    I just subscribed to imatch while logged in to iTunes on a mac computer that belongs to someone else. (I was logged in to MY iTunes)  my iPhone will not turn on the MATCH function, saying I am no subscribed. I've powered off and on.  can anyone help?

    Hi,
    I am having the same problem. Itunes reports that it's uploaded all the music etc.
    When I turn the match function on, it says "you are not currently subscribed to itunes match".
    I have restarted the phone and coputer, logged in & out several times to no avail.
    Any ideas or suggestions?

  • Regex matching bug?

    it seems like j2sdk1.4.2b has some serious regex matching bug with strings that contain unicode characters. In my case, the string contained some Turkish chars.
    regex is simple <[^>]*> which matches string runs that are enclosed in <>
    (ex. <field>)
    although the matching is successful with j2sdk1.4.1_02, it just doesn't match unicode containing text with 1.4.2b
    What do you think? Is this a bug or could I be missing something?

    ahmeti, did you submit a bug report on this? Because it definitely is a bug in the Pattern class, I finally figured out. They added a new node type to make matching ASCII characters in character classes more efficient, but they screwed up the match condition: it always returns false if the character it's looking at is not ASCII, even if the class has been negated. I'll go ahead submit a report myself unless I hear from you.

  • [bug]Jdev 11g:NullPointerException at java.util.regex.Matcher.getTextLength

    Hi,
    Jdev 11.1.1.0.31.51.56
    If somebody of you get the following trace stack when running a jspx using ViewCriteriaRow.setOperator :
    There is bug 7534359 and metalink note 747353.1 available.
    java.lang.NullPointerException
    at java.util.regex.Matcher.getTextLength(Matcher.java:1140)
    at java.util.regex.Matcher.reset(Matcher.java:291)
    at java.util.regex.Matcher.<init>(Matcher.java:211)
    at java.util.regex.Pattern.matcher(Pattern.java:888)
    at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding._loadFilter
    CriteriaValues(FacesCtrlSearchBinding.java:3695)
    Truncated. see log file for complete stacktrace
    Workaround:
    If you use 
            vcr.setAttribute("Job",job);
    or
            vcr.setAttribute("Job","="+job);
    than add following line of code:
            vcr.setOperator("Job","=");   regards
    Peter

    Hi,
    useful to mention that this happens when setting the equal operator or LIKE operator
    vcr.setAttribute("Job","= '"+job+"'");
    or
    vcr.setOperator("Job","=");
    Frank

  • HT204406 help! cannot perform Itunes Match function

    I've owned a iMac for 2 years. Itunes match function used to perform correctly, until about a month ago. My softwares are up to date, including Lion I just installed successfully. Itunes version is the latest.
    When I try to perform Itunes match: Step 1 completes correctly, but NOT step 2. Step 2 stops, then loops back into step 1, and again and again ( loop..)
    Makes me a little sad...
    Anyone to help?

    never mind...just needed to restart the phone...seems to be working now...

  • Improve MATCH() function speed

    I am using a match() function to compare email addresses, looking for matchs of new emails to old. Old emails are in a data set of approx 40k and new emails total 16k. The process takes more than an hour. How might I improve on this performance? Is MATCH the best function to use?
    Thanks
    Kevin

    Hi Kevin,
    Do you need to know where the matching addresses are in the 'old' table, or would knowing whether an address in the 'new' list is matched one or more times in the 'old' list be sufficient?
    If the latter, here's a method that may do the job. I've assumed the 'old' table ("Table 1") has the addresses listed in column C, the 'new' table (Table 2) has them in column D, and that there is one header row on each table
    Add a column to the right of column D in the 'new' table. It will become Column E.
    In E2, enter this formula:
    =COUNTIF(Table 1::$C,D)
    Copy cell E2, click on the column reference tab for column E to select the while column, then command-click on E1 to remove it from the selection.
    Paste.
    The formula will be pasted into every cell in Table 2::E.
    Calculation time will depend on the number of rows in Table 1 and the number of addresses in Table 2.
    Any row with a result in column E of 1 or more contains a duplicate (or more than one duplicate) of the address in the cell to its left. Addresses with zeroes to their right are unduplicated in the 'old' table.
    Regards,
    Barry

  • @Match Function Usage

    Hi All,
    I am trying to use the @Match function within Datacopy but it gives me an error. Here is my code. Any help is appreciated.
    FIX (No_GEO, Plan, Functional)
    Datacopy @Match(Entity, "CC_????_S") TO @Match(Entity, "CC_????");
    ENDFIX

    A syntax issue -- you're not going to be able to use the @MATCH function on the left hand side of the equal side.
    Here's the formula you need:
    FIX(everything you listed in all of your FIXes bar Plan and Entity)
    FIX(@MATCH("Entity", "CC_????"))
    "Plan" = @MEMBER(@CONCATENATE(@NAME(@CURRMBR("Entity")), "_S")) ;
    ENDFIX
    ENDFIX
    This formula:
    1) Selects the current member in the Entity dimension through @CURRMBR
    2) Makes #1 a text string with @NAME
    3) Concatenates the _S
    4) Turns #3 into a member name with @MEMBER
    5) Assigns the value to the Plan Scenario
    The FIX around the members is so that just the CC_???? members get impacted.
    Regards,
    Cameron Lackpour

  • Efficient regex replace function? Help!

    Here's what I'm trying to do:
    Scan through a string, and replace any occurences of http://...... (until the next space) with an HTML link. Does anyone know what would be the most efficient regex replace function to do this?
    Thank you very much in advance.

    class StringReplaceDemo{
         public static void main (String args[]){
              String mystr = "This is hyperlink to Google http:// . From there you can search for any thing in the world";
              String google = "http://www.google.com";
              String hyperlink = "http://";
              int hyperlinklength = hyperlink.length();
              int index = mystr.indexOf("http://");
              mystr = mystr.substring(0,index)+google+mystr.substring((index+hyperlink.length()),mystr.length());
              System.out.println(mystr);
    }

  • Pattern Matching functions in DP Macro

    Folks,
    Can anyone tell me if there are any pattern matching functions in DP Macros? Here is the requirement:
    If the time bucket is a quarter, then hide some rows. If the time bucket is  a month or something finer, then show the same row. Assume that all the time buckets in the data view will be the same (no telescoping buckets profile)
    So, suppose that I use BUCKET_DESCRIPTION and get the name of the bucket. If it is Q.* (using pattern matching lingo here), then I would like to set the row attributes accordingly. If it is M.* then set the row attributes to visible.
    Can you please throw some light on this? Would you do it some other way?
    Thanks,
    Satish

    Hi,
    You may try with the macro function BUCKET_DAYS(). This will find number of days in a given bucket.
    Then you can write condition, If bucket days is more than 1 and less than 7, then it is weekly.
    If bucket days is more than 7, then it is monthly.
    Please see if it is helpful for you.
    Regards,
    Manimaran M.

  • Regex Matching Involving Unicode

    Hi,
    I'm trying to do a regex match using boost::regex and followed the instructions on http://niemannross.com/developer/wiki/index.php?title=Using_boost_regular_expressions_(re gexp)_in_InDesign_CS/CS2/CS3_plug-in_code
    My regex needs to match a line that ends with punctuation characters and return the string that excluding the ending punctuation characters.
    ex. home -> home
    ex regex: (.*?)[ \\x{201C}\\x{201D}]+$
    however it does not match the line.
    I tried using boost::u32regex but i'm getting a boost::icu_regex_traits::translate_nocase symbols not found error on linking.
    How can I go around this problem?
    Thanks in advance!
    -- Jeff

    Escaping the backslash in '\x' is necessary for your programming language, otherwise it is interpreted as a 'real' hex character. So as it is, this feeds '\x{201C]' into your program, rather than the literal 0x201C code. (It'd be a syntax error for C, but you get the point.)
    However: because this is an expression IN GREP inside your running program, I think you have to escape it again, so it might need double double backslashes. Scripts suffer the same problem.

  • Regular exression for matching function declarations or calls

    Hi guys,
    I used a regular expression like \\w + (\\s*) \\( .*\\) (\\s*) [\\{;] to match function
    declarations.This regular expression works fine for all the declarations of the form init_queue(TREE **NODE) {  and even for declarations of the form
    init_queue (TREE **NODE)
    But the problem occurs when i have a declaration of the form
    init_queue(TREE **NODE ,
    int size ) {
    when i have a declaration of this form my regular expression doesnt parse function names.The regular expression . (DOT) means it recognizes anything except for line terminators.So i used the DOTALL option in pattern matching so that .(DOT) matches even line terminators.But using this has a negative effect like i am not able to match declarations of the form
    init_queue(TREE **NODE) { 
    can anyone help me out in solving this
    Thank you,
    Akash

    multipost: http://forum.java.sun.com/thread.jspa?threadID=5168705

Maybe you are looking for

  • Can you automate actions involving pairs of images?

    Hi everyone, This is my situation: I want to take a headshot and a name and then paste both onto a background image and then save out the result.  But I want to do this with many pairs of headshots and names.  The headshot and name are each in separa

  • Please shed some light on Data Center design

    Hi,     I want you guys to recommend what the design should be. I'm familiar with HP blade system. Let me clarify the existing device. 1. HP Blade with Flex Fabric. It supports FCOE. 2. MDS SAN switch for the storage 3. Network Switch for IP network.

  • DataSource 2LIS_12_VCITM

    HI SDN Guru, I am Activating BI Content in Transfer Rules I am getting following error. But this Datasource available in 400 Client, But still I am getting this error. DataSource 2LIS_12_VCITM does not exist in source system GQACLNT400 of version A C

  • How do l unlock te password when someone has put it on and doesn't remember what it is?

    My neice got to my sons ipod touch and put a password on it now she does't remember the password and it is now locked. How do l go about resetting the password or unlocking it so he can use it again?

  • OLAP universe filter with pattern matching.

    Hi, I tried to create both a qaaws and a webi report which contained a filter with pattern matching on an olap universe .  When I ran this it took too long to be usable. I found note 1500666 which says that pattern matching is not supported in MDX an