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 3 of 3
  1. #1
    TNO
    TNO is offline
    Regular Coder
    Join Date
    Apr 2005
    Posts
    213
    Thanks
    2
    Thanked 1 Time in 1 Post

    Internet Explorer Easy Regular Expression?

    Greetings,

    I'm evaluating the following function:

    Code:
    if(Left(delines.item(),18)=="\n                 ")
    This works properly when I need it to, but the following will not:

    Code:
    if(Left(delines.item(),19)=="\n                 \w")
    I'm trying to match a single instance of a nonwhitespace character but am not getting the desired results.

    And please don't tell me to create a regular expression pattern then use the exec method.......

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,733
    Thanks
    202
    Thanked 2,508 Times in 2,486 Posts
    // if (/\s+/.test(theVariable.value)) { // match one or more whitespace characters
    alert ("Whitespace present!");
    }

    or

    // if (/\s/.test(theVariable.value)) { // match just one whitespace character

  • #3
    TNO
    TNO is offline
    Regular Coder
    Join Date
    Apr 2005
    Posts
    213
    Thanks
    2
    Thanked 1 Time in 1 Post
    Thanks, I got it,

    Code:
    if((Left(delines.item(),18)=="\n                 ")&&(Left(delines.item(),19)!="\n                  "))


  •  

    Posting Permissions

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