To find "hello" in your_string

if (your_string.indexOf('hello') > -1)
{
  alert("hello found inside your_string");
}

For the alpha numeric you can use a regular expression:

http://www.regular-expressions.info/javascript.html

Alpha Numeric Regular Expression

Answer from kemiller2002 on Stack Overflow
🌐
W3Schools
w3schools.com › js › js_string_search.asp
JavaScript String Search
The includes() method returns true if a string contains a specified value. Otherwise it returns false. ... Check if a string includes "world". Start at position 12: let text = "Hello world, welcome to the universe."; text.includes("world", 12); ...
Discussions

How can you check if a string contains any one character from a set of characters?
There's str.isdigit() checking if a string contains digits only: >>> '44 a b'.isdigit() False >>> Combined with any, applied to each character: >>> any([c.isdigit() for c in "44 a b"]) True >>> More on reddit.com
🌐 r/learnpython
10
3
May 24, 2022
How can I check if a string contains a number
var hasNumber = /\d/;
hasNumber.test("ABC"); // false
hasNumber.test("Easy as 123"); // true
More on reddit.com
🌐 r/javascript
37
10
December 9, 2012
🌐
W3Schools
w3schools.com › jsref › jsref_includes.asp
JavaScript String includes() Method
The includes() method returns true if a string contains a specified string.
🌐
Bacancy Technology
bacancytechnology.com › qanda › javascript › string-contains-a-substring-in-javascript
How to Check If a String Contains a Substring in JavaScript
June 24, 2024 - You can also use regular expressions to check for substrings within a string. ... const str = 'Hello, world!'; const substring = 'world'; const regex = new RegExp(substring); if (regex.test(str)) { console.log('Substring found'); } else { console.log('Substring not found'); } Work with our skilled Javascript developers to accelerate your project and boost its performance.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › String › includes
String.prototype.includes() - JavaScript | MDN
All values that are not regexes are coerced to strings, so omitting it or passing undefined causes includes() to search for the string "undefined", which is rarely what you want.
🌐
ReqBin
reqbin.com › code › javascript › vy4txenr › javascript-string-contains-example
How do I check if a string contains a substring in JavaScript?
January 24, 2023 - To check if a string contains a substring in JavaScript, use the string.includes(term, start) method, which checks if the string contains the substring. The first parameter is the string to search for, and the second optional parameter specifies ...
🌐
Zipy
zipy.ai › blog › string-contains-substring-javascript
string contains substring javascript
April 12, 2024 - JavaScript provides several methods to determine whether a string contains a specific sequence of characters.
Find elsewhere
🌐
30 Seconds of Code
30secondsofcode.org › home › javascript › string › string contains substring
Check if a string contains a substring in JavaScript - 30 seconds of code
July 27, 2022 - The most straightforward substring search option is String.prototype.includes(), introduced in ES6. It's a simple method that returns a boolean value depending on whether the string contains the substring or not.
🌐
Quora
quora.com › How-can-I-check-if-one-string-contains-another-substring-in-JavaScript
How to check if one string contains another substring in JavaScript - Quora
Answer (1 of 2): ES6 introduced String.prototype.includes: [code]var string = "foo", substring = "oo"; string.includes(substring) [/code][code ]includes[/code] doesn’t have IE support, though. In an ES5 or older environment, String.prototype.indexOf, which returns −1 when it doesn’t find ...
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-string-includes-method
JavaScript String includes() Method - GeeksforGeeks
The includes() method is used to check whether a string contains a specific value.
Published   January 16, 2026
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-program-to-check-if-a-string-contains-any-special-character
JavaScript Program to Check if a String Contains any Special Character - GeeksforGeeks
June 3, 2024 - This article will demonstrate the methods to write a JavaScript Program to check if a String contains any special characters. Any string that contains any character other than alphanumeric and space includes the special character.
🌐
OneCompiler
onecompiler.com › questions › 3xnp9df38 › -javascript-how-to-check-for-special-characters-present-in-a-string
[Javascript] How to check for special characters present in a string? - Questions - OneCompiler
I want to check if there are any special characters present in a given string and return true if exists. How to check that in Javascript? ... You can use a regex to test if a string contains a special character or not.
🌐
Axure Forums
forum.axure.com › axure rp 8
Check if a string contains ONLY specific characters - Axure RP 8 - Axure Forums
January 16, 2019 - I have a string which could contain different text - I’m adding and removing parts of this text with user interactions. At some point, it occurs the string contains only spaces and commas, no meaningful content. What I want is to check - if the string contains ONLY spaces and commas and no other characters, so I could clear the whole meaningless string, replace it with no text, “”. Sure I can check with “does not contain” in the condition builder - every character from A to Z, a to z, but it s...
🌐
freeCodeCamp
freecodecamp.org › news › javascript-string-contains-how-to-use-js-includes
JavaScript String Contains – How to use JS .includes()
November 5, 2021 - Position 3 until the end of the sentence includes these characters and spaces. ... You can see that the (whole) word "love" is not present in that string. In JavaScript you can use the .includes() method to see if one string is found in another.
🌐
freeCodeCamp
freecodecamp.org › news › how-to-check-if-a-string-contains-a-substring-javascript
How to Check if a String Contains a Substring in JavaScript
October 7, 2022 - The JavaScript includes() method was introduced with ES6, and it is the most common and modern way of checking if a string contains a specific character or a series of characters.
🌐
JavaScript in Plain English
javascript.plainenglish.io › 10-ways-to-check-if-a-string-contains-substring-in-javascript-91639d81b7
10 Ways To Check If A String Contains Substring In JavaScript | by Sam C. Tomasi | JavaScript in Plain English
November 23, 2022 - Its main limitation is that it is case-sensitive, so it doesn’t work with strings that contain uppercase and lowercase characters. const string = "Hello World!"; console.log(string.includes("hello")); // false · We can fix this by making the string lowercase before performing the check. const string = "Hello World!"; const substring = "HeLLo"; console.log(string.toLowerCase().includes(substring.toLowerCase())); // true ... New JavaScript and Web Development content every day.
🌐
Mozilla
developer.mozilla.org › en-US › docs › Web › JavaScript › Guide › Regular_expressions
Regular expressions - JavaScript | MDN
For example, the pattern /abc/ matches character combinations in strings only when the exact sequence "abc" occurs (all characters together and in that order). Such a match would succeed in the strings "Hi, do you know your abc's?" and "The latest airplane designs evolved from slabcraft.". In both cases the match is with the substring "abc". There is no match in the string "Grab crab" because while it contains the substring "ab c", it does not contain the exact substring "abc".
🌐
Mastering JS
masteringjs.io › tutorials › fundamentals › contains-substring
Check if a String Contains a Substring in JavaScript - Mastering JS
const str = 'arya stark'; // The most concise way to check substrings ignoring case is using // `String#match()` and a case-insensitive regular expression (the 'i') str.match(/Stark/i); // true str.match(/Snow/i); // false // You can also convert ...
🌐
Vultr Docs
docs.vultr.com › javascript › standard-library › String › includes
JavaScript String includes() - Check Substring Presence | Vultr Docs
November 14, 2024 - The includes() method in JavaScript provides a straightforward approach to verify if a string contains a specific substring.