1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Rep Power

    I want to match " @"+ any character javascript/jquery


    This is what I want to match inside of a textarea:

    " @"+any character to perform an autocomplete operation to find for users when the @ is called and a character is added next to it as the term.

    this is the textarea

    this is the js:
    function strpos (haystack, needle, offset) {
       var i = (haystack + "").indexOf(needle, (offset || 0));
        return i === -1 ? false : i;
    var dauto=function(){
    if(strpos($(this).val(),"@ "+reg_exhere)!==false){
    alert("match found");
    Now I really don't know what to use as the regular expression in there, plus I don't know if using it in there would help as it would loose the look up for the @ before any character so the following string would return true:

    " @ mystring"

    as whereas I only need to find:

    " @anycharacterhere"

    Thanks so much.
  2. #2

IMN logo majestic logo threadwatch logo seochat tools logo