質問

My question is simple:

How do I make the use of JavaScript regex to detect whether a #hashtag is being entered in the input element? I have a function to convert the hashtag into a clickable link but it's PHP. I want a similar function but in jQuery the reason is that if a hashtag is entered then I can send a value to the PHP processor form.

Sorry there is no code as I dont know much about JavaScript regex, also, I could not find any good tutorials.

役に立ちましたか?

解決

You are looking for this: (#\w*)

function hasNonStandard(inputElem) { 
    return /[#\w*]/.test(inputElem.value);
}
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top