How to include a 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..

Looks like you had it right to me.
import java.util.regex.Pattern;
import junit.framework.TestCase;
public class RegexTest extends TestCase{
     public String patternString = "[A-Z0-9\\./]*";
     public void testRegex(){
          Pattern pattern = Pattern.compile(patternString);
          assertTrue(Pattern.matches(patternString, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"));
          assertFalse(Pattern.matches(patternString, "abc"));
          assertTrue(Pattern.matches(patternString, "24.7"));
          assertTrue(Pattern.matches(patternString, "24/7"));
          assertFalse(Pattern.matches(patternString, "21\\7"));
}It works in my tests.
What happends to this "patterns" property? Where and how are you using it?

Similar Messages

  • 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 i can validate a entered text against regular expressions ?

    Thank you for reading my post.
    how i can validate an entered text to checkk its syntax to ensure that it is a domain name ?
    I think i should use RE , but i do not know how i can do this.
    Thank you

    If you want to validate at client side, you need to create a javascript function (validation) and add it to the "onBlur" attribute of the TextField component In the propertysheet (Set it via JavaScrip->onBlur in the property sheet). To put the Actual Java Script, you need to edit the JSP page. If you need to do it server side, create a custom validator.
    http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/customvalidator.html
    - WInston
    http://blogs.sun.com/winston

  • How to improve performence of the procedure using regular expressions

    Hi all,
    I have used substr, instr functions in this procedure .
    Kindly tell me how use regular_expressions in this procedure .
    /* Formatted on 2011/07/20 17:18 (Formatter Plus v4.8.8) */
    PROCEDURE pr_insrt_prcdr_rvne_edit ( --ver 4.4
    p_pa_rqst_sid IN NUMBER,
    p_err_code OUT NUMBER,
    p_err_msg OUT VARCHAR2
    IS
    v_count NUMBER;
    CURSOR error_dtls
    IS
    SELECT parent_target_table_sid, inbnd_target_table_cid,
    target_table_sid
    FROM inbnd_278_error
    WHERE parent_target_table_sid = p_pa_rqst_sid
    AND SUBSTR (error_data_value, INSTR (error_data_value, ':') + 1) IN
    ('5056', '5031');
    CURSOR error_values (
    p_target_table_sid inbnd_278_error.target_table_sid%TYPE
    IS
    SELECT MAX (DECODE (SUBSTR (error_data_value,
    INSTR (error_data_value, ':', 1) + 1
    '5056', SUBSTR (error_data_value,
    1,
    INSTR (error_data_value, ':', 1) - 1
    ) AS e5056,
    MAX (DECODE (SUBSTR (error_data_value,
    INSTR (error_data_value, ':', 1) + 1
    '5031', SUBSTR (error_data_value,
    1,
    INSTR (error_data_value, ':', 1) - 1
    ) AS e5031
    FROM inbnd_278_error
    WHERE target_table_sid = p_target_table_sid
    AND SUBSTR (error_data_value, INSTR (error_data_value, ':', 1) + 1) IN
    ('5056', '5031');
    v_error_values error_values%ROWTYPE;
    BEGIN
    p_err_code := 0;
    p_err_msg := 'Success';
    FOR curr_error_dtls_rec IN error_dtls
    LOOP
    OPEN error_values (curr_error_dtls_rec.target_table_sid);
    FETCH error_values
    INTO v_error_values;
    IF (v_error_values.e5056 IS NOT NULL
    AND v_error_values.e5031 IS NOT NULL
    THEN
    DELETE FROM inbnd_278_error
    WHERE SUBSTR (error_data_value,
    INSTR (error_data_value, ':') + 1
    ) IN ('5056', '5031')
    AND target_table_sid = curr_error_dtls_rec.target_table_sid
    AND inbnd_target_table_cid = 109;
    INSERT INTO inbnd_278_error
    (inbnd_278_error_sid,
    parent_target_table_sid, inbnd_target_table_cid,
    target_table_sid, meta_data_cid,
    error_data_value,
    created_by, created_date
    VALUES (inbnd_278_error_seq.NEXTVAL,
    curr_error_dtls_rec.parent_target_table_sid, 109,
    curr_error_dtls_rec.target_table_sid, 161,
    v_error_values.e5056
    || ','
    || v_error_values.e5031
    || ':'
    || '5059',
    1, SYSDATE
    END IF;
    CLOSE error_values;
    END LOOP;
    EXCEPTION
    WHEN OTHERS
    THEN
    p_err_code := SQLCODE;
    p_err_msg :=
    'Error occured in pr_insrt_prcdr_rvne_edit procedure '
    || SUBSTR (SQLERRM, 1, 100);
    END pr_insrt_prcdr_rvne_edit;
    Thanks,
    P Prakash
    Edited by: prakash on Jul 20, 2011 4:48 AM

    Yes as explained in the forum FAQ which you should read
    http://forums.oracle.com/forums/ann.jspa?annID=1535
    *2. How do I ask a question on the forums?*
    SQL and PL/SQL FAQ
    And the section beginning.
    *9) Formatting with {noformat}{noformat} Tags*                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to split a string with a delimiting regular expression like "\r"

    Hello!I am a fresh in java programming.Please don't deride my question.What I want to realize is to get the current caret lines and cols in a JTextPane. My question is :After I fetch the string content of the JTextPane and try to split it with the end-line token like "\r" or "\r\n",it always comes me an wrong position.
    here is my code:
    public void caretUpdate(CaretEvent e) {
    int ln,col;
    JTextPane textSource = (JTextPane)e.getSource();
    String sourceString = textSource.getText();
    String subString = sourceString.substring(0,
         (e.getDot() == 0) ? 0 : e.getDot()-1);
    String[] splitString = subString.split("\r",-1);
    ln = splitString.length;
    col = e.getDot() - subString.lastIndexOf("\r");
    setCaretPosition(ln,col); //display ln and col in a label
    I have got puzzled>_<.Please help me.Any help would be appreciated . (^-^)

    Swing text components always use "\n" to separate lines, not "\r" or "\r\n". When you read text in from a file or paste from the clipboard, the line separators are converted to "\n" if necessary. They save the info about what line separators were used in the source file, so if you write the text back to a file it converts them back.

  • How to include Forward button dynamically using code?

    hello,
    i am creating my notification message dynamically using clob type document type attribute , and its working fine. But how i include the Forword Button in my message body.
    please advice

    i am allready doing that only, in that what will be the name of the button.
    can i put like this.
    htp.p( '<input type="button" name="forward">');
    then what about the event, shall i have to write the code for forward also.
    please advice.

  • Pages 2.0.2 in Palatino will not allow capital O followed by forward slash but insists on converting it into Sandinavian Ø. How can I stop it?

    Pages 2.0.2 in Palatino will not allow capital O followed by forward slash but insists on converting it into Sandinavian Ø. How can I stop it?

    The best way to stop it is to get rid of the obsolete font.  Palatino 3.8 from 2006 should normally also be present as part of iLife/iWork and it works correctly. 

  • Applescript: How to reference to a filename with forward slash character?

    Hi,
    I have this script line:
    do shell script "lpadmin -p CIN-East-Copier -E -v lpd://192.168.51.78 -P '/Library/Printers/PPDs/Contents/Resources/LANIER MP C5501/LD655C'"
    The filename is "LANIER MP C5501/LD655C", the forward slash in the name is a character, not a folder structure.
    The script above works perfectly for drivers without the forward character.  Can anyone help me how to make it work?  I tried replacing the forward slash with URL encoded character, changing the structure to colon delimited (i.e. Macintosh HD:Library:Printers....etc), none work.
    Thanks!

    Since the / is the standard directory delimiter, it is not usually valid in a filename. It's extremely unusual to find such a character in a filename. However, all is not lost... there is a trick.
    Since the standard Mac OS paths used colon-delimited paths, and UNIX uses slash-delimited, there is a kind of hybrid solution... you can use the colon in the shell and it interprets as a slash, e.g.:
    do shell script "lpadmin -p CIN-East-Copier -E -v lpd://192.168.51.78 -P '/Library/Printers/PPDs/Contents/Resources/LANIER MP C5501:LD655C'"
    I haven't tried it, but you might need to escape (with a backslash) the colon:
    do shell script "lpadmin -p CIN-East-Copier -E -v lpd://192.168.51.78 -P '/Library/Printers/PPDs/Contents/Resources/LANIER MP C5501\\:LD655C'"

  • How to use EWS or Powershell to rename all folders that have a forward slash in them

    We have many users that have created folders in Outlook that have forward slashes in the name (i.e. / ). They did this in Outlook/Exchange 2003. We upgraded to Outlook 2010 and this is no longer aloud so there are issues with the folders when performing
    functions such as trying to share or using IMAP, etc.
    I'm looking for a way to specify a particular user's mailbox in a script and have it traverse every folder/subfolder and check if there is a forward slash in the name. If there is a forward slash I would like to rename the folder to something like the bar
    character (i.e |) or another character that is valid.
    I had most users go through Outlook manually and clean them up. However there are a handful of users that have hundreds if not thousands of subfolders that have the forward slash in them.
    I've done extensive research on this (references to my research below) and came close in putting a script together but I just can't figure it out. Anyone have an example for this? Even if I need to specify a folder within the Inbox and have the script only
    process subfolders from this location would be acceptable since most of them are subfolders of a particular folder.
    Thank you.
    http://social.technet.microsoft.com/Forums/exchange/en-US/b24d0558-ed6a-4854-9a86-e9815741b5d0/rename-folder-example-in-ews?forum=exchangesvrdevelopment
    http://exchange-powershell.com/database-management/bulk-public-folder-rename-and-cleanup-script/
    http://unlockpowershell.wordpress.com/2010/10/14/powershell-rename-a-mailbox-folder-using-exchange-web-services-api/

    First two articles are for public folders so it won't help here as you have mailbox folders...
    http://unlockpowershell.wordpress.com/2010/10/14/powershell-rename-a-mailbox-folder-using-exchange-web-services-api/ 
    This is good starting point, you might need to change the logics around it  to search / and replace with - or someting, this might be the code change needed from that article but would suggest you to test it first.
    foreach ($folder in $ffResponse.Folders)
    if ($folder.Displayname -like “*/*”)
    Write-Output “Found / in the $mailboxName and folder name is $folder.Displayname”
    $folder.Displayname.Replace("/","-")
    $folder.Update()
    Blog |
    Get Your Exchange Powershell Tip of the Day from here

  • No forward slash when in Safari???

    In order to access my web mail, I have to enter my domain name and password. My domain name includes the "\"; however, when browsing in Safari, there is no forward slash?? How is this possible? Does this mean I cannot access my web mail?

    I just realized that if you're using the keyboard for the URL bar, the "#+=" button isn't there.
    Have you tried entering it as a hexadecimal equivalent? For example, if you need to enter "john\adams", instead put in "john%5Cadams" (%5C is the hex code for "\")

  • Index.html pages in local sub-directories will not load automatically when sub-directory name entered into address field, followed by a forward-slash

    I am in the process of designing a website-on-a-CD. In order to make things easier for my clients, I decided to organize this site into local sub-directories with an index.html page in each one. However, when I try to enter the local sub-directory name, followed by a forward-slash, the index page does not open automatically. Instead, I get a raw directory listing that includes the index.html file, and anything else that is present within it. I would like to know if there is any way to force this page to load automatically within Firefox from a local storage medium as it would load from a web-server.

    You need to use file:// as the protocol instead of C:/. The latter may never work (C:\ might).
    Where is the main HTML located ?
    Easiest if to store the images in a sub folder of the location because you can't go back via ../ beyond that root location for security reasons.
    See:
    *http://kb.mozillazine.org/Links_to_local_pages_do_not_work

  • Can't log in with valid password, can't boot from disk, can't access disk utility, in single user mode can't reset password as appears locked in caps mode with '?' for forward slash, can anyone help?

    Can't log in with valid password, can't boot from disk, can't access disk utility, in single user mode can't reset password as appears locked in caps mode with '?' for forward slash, can anyone help?

    Which keyboard layout you were using? German, French ... I suppose your layout is reset to the default: US and you are unable to find the "?" or "/" ...
    Please have a look into the keyboard viewer, to see how the layout of your keyboard is actually.
    marek

  • When typing an 'L' followed by forward slash '/' I get a weird character

    I can't figure this out. whenever I type a string of text that requires an L and forward slash together I get some weird character that resembles an 'f' like for designating a 'function' in an equation only its backwards. this occurs in terminal, like in this example: cd /usr/local/name the 'l' at the end of local and the forward slash become one character. I can't duplicate this character any other time, just when l/ are in a string. Any ideas? I get this in terminal and entourage (only in plain text mode - html emails the character doesn't show) mainly.

    What you are seeing is a diacritic of an L with a line through it. It does the same for o/. You are probably using a font like Palantino, Hoefler, Chicago, or New York.
    I don’t use Terminal so I don’t know how to change it in that application, but in TextEdit
    1. open the Font panel (Format/Fonts/Show Fonts, or Command-t)
    2. from the Action menu (small gear shape in lower left corner) choose Typography
    3. in the Typography window select the Diacritics section (if there is no Diacritics, select in the Fonts panel one of the fonts mentioned above, like Chicago and the Typography window will change to show a Diacritics panel)
    4. click Don’t Compose Diacritics button
    I couldn’t find a Show Fonts command in Terminal, but now that you know the procedure, maybe you can figure it out.

  • How to include a KB Update into a WIM in order to point to the WIM when using DISM (details inside)?

    Hi, I was told in another of the forums that my issue
    is best suited for the TechNet audience.  Previously, I posted it here: http://answers.microsoft.com/en-us/windows/forum/windows8_1-system/how-to-include-a-kb-update-into-a-wim-in-order-to/e7015076-b4a9-4862-a73b-6c58b4c82461?tm=1409598696763
    I've been struggling to fix a corrupted file.  
    Context:  I feel that something is not right with the computer, so I started poking around.
    I used "sfc /scannow" from an elevated command prompt and the result was: 
    Windows Resource Protection found corrupt files but was unable to fix some of them. Details are included in the CBS.Log <var style="border:0px;margin:0px;padding:0px;vertical-align:top;-webkit-font-smoothing:antialiased;">%WinDir%</var>\Logs\CBS\CBS.log.
    I looked in the log.  This message appears 4 times:
    Cannot repair member file [l:36{18}]"Amd64\CNBJ2530.DPB" of prncacla.inf, Version = 6.3.9600.16384, pA = PROCESSOR_ARCHITECTURE_AMD64 (9), Culture neutral, VersionScope = 1 nonSxS, PublicKeyToken = {l:8 b:31bf3856ad364e35}, Type = [l:24{12}]"driverUpdate",
    TypeName neutral, PublicKey neutral in the store, hash mismatch
    There is also the following message:
    This component was referenced by [l:186{93}]"Microsoft-Windows-Printer-Drivers-Package~31bf3856ad364e35~amd64~~6.3.9600.16384.INF_prncacla"
    I'm not positive what to do next, but I have been led to believe the problem is that Flash files in version 6.3.9600.16407 are corrupted, that I need to find which KB updates Flash to this version, download the file, add it to a new WIM, and point
    to it when using DISM.  I'm not positive this is correct, but it was suggested.
    I downloaded the KB update: kb2889543, but I do not know how to add it to a new WIM or what the repercussions of doing so will be (e.g. Will I lose everything and have to restore my documents, etc from my external drive by doing this?).  
    So, the question is: How can I include a KB Update into a WIM and tell me what the result will be when once I do and point to it when using DISM?
    Secondarily, if this is a bad way to move forward with the issue, would some kind soul offer sage advise on how to move forward with resolving the original issue?

    Hi TTQSTTQS,
    As you mentioned in the answers forum, when run  the command DISM /Online /Cleanup-Image /RestoreHealth,  we received the error message “The source files could not be downloaded. Use the "source" option to specify the
    location of the files that are required to restore the feature”.
    When run the command Dism /Online /Cleanup-Image /RestoreHealth /Source:c:\test\mount\windows /LimitAccess, we met the same error message.
    I think there are some mistakes in the source setting, so we meet the same error messages.
    As I mentioned in the last reply, we need a mounted image as a repair source, and then use this path.
    We need to configure a Windows repair source. Please refer to the following article.
    http://technet.microsoft.com/en-us/library/hh825020.aspx
    Please refer to the following steps to set the source image.
    1. Assign Drive Letters to Partitions by Windows PE.
    2. Capture Partition Images using DISM
    For more information, please refer to the following article.
    http://technet.microsoft.com/en-us/library/hh825072.aspx
    Then, we could try the command Dism /Online /Cleanup-Image /RestoreHealth /Source:c:\test\mount\windows /LimitAccess.
    Best regards,
    Fangzhou CHEN
    Fangzhou CHEN
    TechNet Community Support

  • File Sharing - Shared folder with forward slash in name

    I have a shared folder that has a forward slash in the name:   Test/Folder
    I can't remove it.
    Any suggestions on how to delete this from the File Sharing?

    Try this:
    sudo sharing -r name
    where name is the name of the sharepoint you want to delete.

Maybe you are looking for

  • Multiple devices & family members

    Ok, I am new to the Apple family and am confused on some items. I have an Iphone and Imac, my kids have Itouches, and ipods, my husband is addicted to the ipad! So, Does each person need to set up their own apple id? We have all been using mine. I ju

  • ABAP DUMP while loading master data

    hi Gurus,               I am trying to load master data but I am getting the following dump , I cannot infer anything from the Dump message, I would be grateful if anyone could throw some light on it.. Runtime Errors         SAPSQL_ARRAY_INSERT_DUPRE

  • Can you stream from BBCi Player using Apple TV?

    Hi All, Looking into getting the apple TV for my dad but want to know if it will actually come in handy so please tell me ... Can you stream from BBCi Player/ITV Player from laptop to TV via the Apple TV? Many Thanks

  • Html to image but wrong font

    I found some code to convert an html to an image. Using the codeexample, i get a nice png-image but it has a wrong font. I tried changing it in the html-source but it doesn't help. any idea? import javax.imageio.ImageIO; import javax.swing.*;* *impor

  • Finesse - Admin gadget

    Hello all, I install finesse 9.0.1 all is ok, but when I connect to cfadmin I see same problem as describe in CICSO bug CSCtw61972, Buttons (Submit, Reset) on the Admin gadget not active, circle image. Do you have any help? I need configure installat