RegExp for excluding special characters in a string.

Hi All,
Im using Flex RegExpValidator. Can anyone suggest me the correct expression to validate this condition?....
I have tried this expression :----- /^[^///\/</>/?/*&]+$/...But in this it is also negating the alphabets.Also I have tried with opposite condition that in the String we should have alphabets and the expression is:-- ([a-z]|[A-Z]|[0-9]|[ ]|[-]|[_])*..... Please can anyone help me on this.
Thanks in advanced to all.
Munira

sorry but you are posting things back that do not make any sense
what do you mean with the below comment?
munira06 wrote:
Yes you are correct ,but I have tried this with single special character
say
Re: RegExp for excluding special characters in a string.
here is a sample app taken from the live docs
using ^[a-zA-Z0-9 \-_]*$ as the regex accepts all characters from a-z, A-Z, 0-9 - [space] and_
run the example tell me what regex you are using and what test strings fail when they should pass or pass when they should fail
<?xml version="1.0" encoding="utf-8"?>
<!-- Simple example to demonstrate the RegExpValidator. -->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/mx">
    <fx:Script>
        <![CDATA[
            import mx.events.ValidationResultEvent;
            import mx.validators.*;
            // Write the results to the
            private function handleResult(eventObj:ValidationResultEvent):void {
                if (eventObj.type == ValidationResultEvent.VALID) {
                    // For valid events, the results Array contains
                    // RegExpValidationResult objects.
                    var xResult:RegExpValidationResult;
                    reResults.text = "";
                    for (var i:uint = 0; i < eventObj.results.length; i++) {
                        xResult = eventObj.results[i];
                        reResults.text=reResults.text + xResult.matchedIndex + " " + xResult.matchedString + "\n";
                } else {
                    reResults.text = "";
        ]]>
    </fx:Script>
    <fx:Declarations>
        <mx:RegExpValidator id="regExpV"
                source="{regex_text}" property="text"
                flags="g" expression="{regex.text}"
                valid="handleResult(event)"
                invalid="handleResult(event)"
                trigger="{myButton}"
                triggerEvent="click"/>
    </fx:Declarations>
    <s:Panel title="RegExpValidator Example"
            width="75%" height="75%"
            horizontalCenter="0" verticalCenter="0">
        <s:VGroup left="10" right="10" top="10" bottom="10">
            <s:Label width="100%" text="Instructions:"/>
            <s:Label width="100%" text="1. Enter text to search. By default, enter  a string containing the letters ABC in sequence followed by any digit."/>
            <s:Label width="100%" text="2. Enter the regular expression. By default, enter ABC\d."/>
            <s:Label width="100%" text="3. Click the Button control to trigger the validation."/>
            <s:Label width="100%" text="4. The results show the index in the text where the matching pattern begins, and the matching pattern. "/>
            <mx:Form>
                <mx:FormItem label="Enter text:">
                    <s:TextInput id="regex_text" text="xxxxABC4xxx" width="100%"/>
                </mx:FormItem>
                <mx:FormItem label="Enter regular expression:">
                    <s:TextInput id="regex" text="ABC\d" width="100%"/>
                </mx:FormItem>
                <mx:FormItem label="Results:">
                    <s:TextInput id="reResults" width="100%"/>
                </mx:FormItem>
                <mx:FormItem >
                    <s:Button id="myButton" label="Validate"/>
                </mx:FormItem>
            </mx:Form>
        </s:VGroup>
    </s:Panel>
</s:Application>

Similar Messages

  • Regexp for exclude special characters

    hi!
    i need a regular expression, which allows all chars and digits [A-Za-z0-9], without special characters like []@.
    anyone can help me? thx!
    bye,
    christian

    Hello Christian,
    first throw of mine would look like something of this:
    ^[A-Za-z0-9]*$^ gives you the start
    $ gives you the ending
    * gives you zero or more repititions. You can replace this with {min,max}, which gives you a minimum and maximum length.
    If you would like to know more about regular expressions this link might be useful for you.
    Regards,
    Tine

  • How to search special characters in a string

    Hi all,
    I want to search special characters in all string columns and all rows in the table.
    The table has about 5 string columns and about 5.000.000 rows. For each row and column, I have to search entries, which included special characters like ", !, ? or something else (f.ex. "Mama?Mia" or "!!!Hotel out of order!!!"). The problem, the character could stand at each position in the string.
    What's the best and most performance possibility to search such entries?? Is it possibility only by SQL; is there a special function for this?? Or must I use PL/SQL.
    Thanks for helping
    Dana

    HTH
    Laurent Schneider
    OCM DBA
    SQL> select * from z;
    S
    Mama?Mia
    a b c
    123
    SQL> select * from z where translate(s,'~ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz1234567890','~') is not null;
    S
    Mama?Mia
    SQL> select * from z where regexp_like(s, '[^[:alnum:][:space:]]');
    S
    Mama?Mia

  • Need help in replacing special characters in a string

    Hi,
    please let me know the best way to replace all the special characters in a string with space.
    other than alphabets and numbers
    with regards.
    sumanth.

    please let me know the best way to replace all the special characters in a string with space.
    other than alphabets and numbers
    >
    Sumanth Nag Kristam wrote:
    > actually i need to replace hexa decimal char 0X1A in a string.... that is 'substitue' as per the chart
    > any pointers....
    >
    > chk the link for the ASCII codes
    > http://www.techonthenet.com/ascii/chart.php
    But in Hexa decimal value there is no special characters?

  • Sample code to identify special characters in a string

    Hi,
    I need to identify special characters in a string.... could anybody send me some code please.......
    Thanks,
    Best regards,
    Karen

    data: str(100) type c.
    data: str_n type string.
    data: str_c type string.
    data: len type i.
    data: ofst type i.
    str = '#ABCD%'.
    len = strlen( str ).
    do.
      if ofst = len.
        exit.
      endif.
      if str+ofst(1) co sy-abcde.
        concatenate str_c str+ofst(1) into str_c.
      else.
        concatenate str_n str+ofst(1) into str_n.
      endif.
      ofst = ofst + 1.
    enddo.
    write:/ str.
    write:/ str_c.
    write:/ 'spacial chracter',20 str_n.
    Function module  <b>SF_SPECIALCHAR_DELETE</b> <b>DX_SEARCH_STRING</b>
    l_address1 = i_adrc-street.
    CHECK NOT L_ADDRESS1 IS INITIAL.
    len = STRLEN( l_address1 ).
    do len times.
    if not l_address1+l(1) ca
    'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 '.
    if i_adrc-street+l(1) CO sy-abcde.
    elseif i_adrc-street+l(1) CO L_NUMCHAR.
    exit.
    endif.
    l = l + 1.
    enddo.
    data : spchar(40) type c value '~!@#$$%^&()?...'etc.
    data :gv_char .
    data:inp(20) type c.
    take the string length .
    len = strlen (i/p).
    do len times
    MOVE FNAME+T(1) TO GV_CHAR.
    IF gv_char CA spchar.
    MOVE fnameT(1) TO inp2T(1).
    ENDIF.
    T = T + 1.
    enddo.
    REPORT ZEX4 .
    PARAMETERS: fname LIKE rlgrap-filename .
    DATA: len TYPE i,
    T TYPE I VALUE 0,
    inp(20) TYPE C,
    inp1(20) type c,
    inp2(20) type c,
    inp3(20) type c.
    DATA :gv_char.
    data : spchar(20) type c value '#$%^&*()_+`~'.
    START-OF-SELECTION.
    CONDENSE fname.
    len = strlen( fname ).
    WRITE:/ len.
    DO len TIMES.
    MOVE FNAME+T(1) TO GV_CHAR.
    IF gv_char ca spchar.
    MOVE fnameT(1) TO inpT(1).
    ENDIF.
    T = T + 1.
    ENDDO.
    CONDENSE INP.
    write:/ 'Special Characters :', inp.
    Rewards if useful..........
    Minal

  • Use of special characters in Search String

    What is the use of special charaters like
    in the search string in the Find & Replace of ABAP editor ?
    I want to search for all strings starting with V which are followed by alphabets like
    VA
    VB...
    If I use V*, it also gives me results like
    V/R...
    Whether it is possible to specify such a condition?

    Hi,
    While giving ur search in FIND & REPLACE,
    use the match case or match whole word only..
    Then u will get search results only where the exact case of that variable is used..
    As per my knowledge there is no signification of special characters ,- : ; in the search string..
    Hope this helps...
    Cheers,
    Simha.

  • PDS - XML format, unable to read special characters in a string.

    Hi All,
    I've been using XML files to create my report with Oracle9i's new featue of PDS.
    Now, I'm unable to read a file if it contains '&' or '<' in the string. In fact, the xml file itself not able to crate a xml page in the browser, if these special characters are present.
    Is there any way to solve this problem ?
    I can't tell the users to remove &, < from the description data. Is there any way to workaround for this ?
    Thanks in advance,
    Satya.

    Hi Rohit and Rajesh
    Thanks for your reply.
    In fact, my problem is like this:
    I'll get data in .txt file and save that as a .xml file in the network before calling Oracle report ,which gets data from the .xml.
    The contents are like this:
    <Comapy name> Ford Motors UK & Europe</Company name>
    <Department> HR & Pensions</Depatrment>
    <Salary>Grad4 < 25000 </Salary>
    As per XML entity character representation, I need to replace '&' with '&amp;' and '<' with '<lt;'
    I'm wondering is there any other way to solve this problem as it is difficult to replace '<' and '>' generically.
    Honestly, I couldn't understand what Mr. Rajesh was trying to tell.
    'for & use & ( with semicolon at the end)'
    'for < use <'
    'for > use >'
    Can you shed some light on this ?
    Many thanks
    Satya.

  • How can I find special characters in a string

    Hi,
    I have a small task where I have to find special characters in a given string, Can anyone suggest.......................

    What is your definition of a "special character", could you be a bit more specific?
    Do you simply want to find the position of a specific character in the string?
    Can it occur more than once and you want to find all occurences?
    What should happen if the special character does not exist?
    For programming purposes, all 256 possible 8 bit characters (x00-xFF) can be treated the same. Non-printing characters can be entered in \-codes or hex display if needed.
    LabVIEW Champion . Do more with less code and in less time .

  • Replace all special characters in a String with underscore

    I have a String which contains some special characters even(!,$,@,*....).
    I need to replace all the special characters with _ in my String. I do have an idea of using String.replace() and analogous forms, but I would be thankful if anyone can suggest me of a better and an efficient way.
    regards,
    fun_one

    Kaj,
    Thx for your earnest reply. I did have a peep into the API on this method. But the regular expression that I need to use here was beyond my understanding. It did specify some regex that I put to use (something like myString("\D","_"), assuming that I need to replace all non-digit characters ), but it really did not help me getting the result.
    Would you spare some code for me reg. the usage of regular expressions in such a scenario?
    cheers,
    fun_one

  • Check special characters in a string

    Hi all
    I am using oracle 10g.......
    Need to know what should be the query to check whether a special character exists or not in a column value....used the following query like.....
    select count(*) into emp_no_count_special_char
    from dual
    where REGEXP_LIKE(insert_data_rec.emp_no , '[#!$^&*%./\|]$' )
    or REGEXP_LIKE(insert_data_rec.emp_no , '^[#!$^&*%./\|]' );
    This works fine in case a string starts or ends with a special character ,what if a string of special characters lies in between numeric digits.
    e.g: '100#$%7'
    Please help find a query that checks for the existence of sp. characters irrespective of their position in the column!!!
    Thanks
    Dave
    Edited by: Dave on Jun 6, 2012 5:17 AM
    Edited by: Dave on Jun 6, 2012 5:18 AM

    Hi Dave,
    example below:
    -- Check that at least one special character exists in the string
    SELECT COUNT (*)
      INTO emp_no_count_special_char
      FROM DUAL
    WHERE REGEXP_LIKE (insert_data_rec.emp_no, '[#!$^&*%./\|]');
    -- Check that no special characters exist in the string
    SELECT COUNT (*)
      INTO emp_no_count_special_char
      FROM DUAL
    WHERE NOT REGEXP_LIKE (insert_data_rec.emp_no, '[#!$^&*%./\|]');
    {code}
    Regards.
    Al                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Check whether there is any Special Characters in a String ?

    Hi All,
    I am having a very large String. I like to know how to check whether there is any special characters present in a string
    Thanks,
    J.Kathir

    I am having a very large String. I like to
    I like to know how to check whether there is any
    special characters present in a stringAll characters are special in a way. You shouldn't just single a few out because they don't look "normal" to you. Maybe they have golden hearts?

  • Finding special characters in a string

    Hi all, I'm using Oracle 10g.
    I have a column name with special characters. how can i replace the special characters in the column with space and no space depending on the special character. please see the example below. can i use REGEXP_REPLACE?
    create table
    create table sample_test (
      Name    VARCHAR2(20 BYTE))insert table
    insert into sample_test values ('O''NEIL')
         insert into sample_test values ('B.E.VICTOR')
          insert into sample_test values ('WILLIAM,L')
           insert into sample_test values ('MARY-ANNE')
               insert into sample_test values ('VON_ANCKEN')
                insert into sample_test values ('BROWN;L')i would like the output as follows
    Special Character         Name         Expected Name                  Remarks     
    Single Quotes            O'NEIL                  ONEIL                          Remove quotes and no space       
    Dot                      B.E.VICTOR         B E VICTOR                          Replace with space       
    Comma                      WILLIAM,L         WILLIAM L                          Replace with space       
    Hyphen                      MARY-ANNE         MARY ANNE                          Replace with space       
    Underscore                VON_ANCKEN         VON ANCKEN                          Replace with space       
    Semi Colon              BROWN;L          BROWN L                          Replace with space      Please advise.
    Thanks
    Bob

    A simple solution without regexp usage:
    -- Test Data
    with sample_test as
    select 'O''NEIL' name from dual union all
    select 'B.E.VICTOR'  name from dual union all
    select'WILLIAM,L' name from dual union all
    select'MARY-ANNE' name from dual union all
    select'VON_ANCKEN' name from dual union all
    select'BROWN;L' name from dual
    -- Query:
    select name old_name,
           translate(replace(name,'''',''),'.,-_;','     ') new_name
    from sample_test;Explanation:
    REPLACE deletes the quote
    TRANSLATE replaces dot, comma, hyphen, semicolon and underscore

  • Strategies for escaping special characters.

    Hi all,
    Our app(built using Workshop) needs to have a generic way of scrubbing special
    characters that a user might enter in the UI,and which might cause our sql that
    queries the DB to become malformed. To explain further,some of our DB controls
    are not using PreparedStatements to set Strings..instead, we are constructing
    the sql as a java string like:
    String myQuery="Select * from * where TOUPPER(name) like"+param.ToUpperCase().
    and then we do:
    Statement stmt=conn.createStatement();
    stmt.executeQuery(myQuery).
    In such cases, Oracle JDBC driver does not escape any special chars in the String
    param,and fails.Other than converting all our queries to use PreparedStatements,
    is there a generic pattern/Util class(mebbe RequestUtils) or some way of using
    the Servlet Filter API to scrub out any special chars that are input by the user?
    Thanks in advance.
    Vik.

    ServletFilter is the way to go on this one. Don't think there is anything built
    into Servlet spec that handles these characters, however, there are a number of
    sample filters that do such a task. I think there is a sample in either the O'Reilly
    book on Servlets or Core Servlets.
    "Vik" <[email protected]> wrote:
    >
    Hi all,
    Our app(built using Workshop) needs to have a generic way of scrubbing
    special
    characters that a user might enter in the UI,and which might cause our
    sql that
    queries the DB to become malformed. To explain further,some of our DB
    controls
    are not using PreparedStatements to set Strings..instead, we are constructing
    the sql as a java string like:
    String myQuery="Select * from * where TOUPPER(name) like"+param.ToUpperCase().
    and then we do:
    Statement stmt=conn.createStatement();
    stmt.executeQuery(myQuery).
    In such cases, Oracle JDBC driver does not escape any special chars in
    the String
    param,and fails.Other than converting all our queries to use PreparedStatements,
    is there a generic pattern/Util class(mebbe RequestUtils) or some way
    of using
    the Servlet Filter API to scrub out any special chars that are input
    by the user?
    Thanks in advance.
    Vik.

  • Print preview for the special characters / symbols

    While displaying print preview / taking print output using QGA3 Transaction with developed Z SAPScript form specified as one of the parameters(say for example ZARMEXP), the special characters / symbols  like u2018∆u2019 are displayed as u2018#u2019 in the print preview / print output . Of course similar problem had existed for Lambda Symbol u2018u03BBu2019., but it was resolved by using the font type Helve_I7. But for the symbol u2018∆u2019 we checked with almost all the fonts that were available in the system, but of not much use. Hence could you kindly provide us solution(s) that would resolve this issue.

    Hi ,
    Can you please check language are installed properly in sap  check with basis people. then try to print it will work.
    when ever language are not maintin properly , the characters  or symbols are not print properly.
    Regars,
    Munibabu.k

  • How to replace string containing special characters by another string

    Hi all,
    I have to Search for a pattern and replace it by a substitute pattern [Eg: Replace methodOrig (a,b) with  SessTime = getSessionParameter(time);  methodNew(a,b,SessTime) ] in files.
    i tried this using replace(),but it din't work since string1 contains special characters.
    can anyone help me asap.
    thanks in advance.

    Double-post: http://forum.java.sun.com/thread.jspa?threadID=599211&tstart=0

Maybe you are looking for

  • My account has been disabled, how do I enable it?

    The apple people disabled my iCloud account because someone charged something on my account. Does anyone know how to deactivate it?

  • Font problem after fixing startup problem

    hey, I was having a problem starting up my powerbook I ran utility disk now it starts up but all the fonts are a capital A inside a box.any one know whats going on thanks james

  • Reminders in IOS5

    I am puzzled over two things: 1. Why doesn't the reminders app in the iPad and iPhone offer me the chance to give a task a date and not a time (which it does in iCal)? 2. In the pull down notification centre the only remonders that appear are the one

  • How do I make siri use the mic on the iPhone and not the blue tooth mic?

    When I get in my car, the blue tooth connects to the built-in car kit.  I want to use the car kit for phone calls, but I want to use the iPHone mic for Siri.  Siri always gets it wrong when it uses the  car mic.  Is this possible?

  • Scan interface mode erreur -805

    Bonjour, Je suis débutant de système Compact RIO. J'ai quelques questions sur le scan interface mode. Le matériel que j'utilise est  le contrôleur cRIO-9012 et chassis cRIO-9101 intégré une carte AI 9205 une carte DIO 9401 Je voudrais utiliser le sca