Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: reg ex help

  1. #1
    New to the CF scene
    Join Date
    May 2006
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    reg ex help

    I want a regular expression such that it will not allow " and ' in a text.

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,079
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    <script type="text/javascript">

    function noquotes() {

    re = /[\'\"]/ ;
    if (re.test(document.f1.t1.value)) {
    document.f1.t1.value = document.f1.t1.value.replace(/[\'\"]/g,"");
    }
    }

    </script>

    <form name="f1">
    <input type="text" name="t1" onkeyup="noquotes()">
    </form>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •