## How to .search() multiple strings and have at least 1 to then do function?

excel search for multiple text strings in cell
excel check if cell contains text from list and return value
if cell contains (multiple text criteria) then return (corresponding text criteria)
excel search multiple values in single cell
excel search a cell for a list of words
excel search array for text
=if(isnumber(search( for multiple cells
if cell contains text from list then return value

I'm programming a calculator for my final high school math project and I can't seem to find how to .search() multiple strings and if the element has at least one then it will work.

```    function pie(val) {
var pi = document.getElementById("display").value.search("/" | "*" | "-" | "+");
if (pi != -1) {
document.getElementById("display").value += val;
}
else {
document.getElementById("display").value = "Please add an operator";
}
}
```

I want Pi to only execute if there's an operator because if there's none it just adds PI to whatever number is on the screen.

```// Clear Function
function c(val) {
document.getElementById("display").value = val;
}
// Insert Number Function
function insert(val) {
document.getElementById("display").value += val;
}
// Equal Function
function equal(val) {
try {
c(eval(document.getElementById("display").value))
}
catch(equal) {
document.getElementById("display").value = "error";
}
}
// Root Function
function root(val) {
var vroot = document.getElementById("display").value;
var rooted = Math.sqrt(document.getElementById("display").value);
var r = document.getElementById("display").value = rooted;

if (vroot< 0) {
document.getElementById("display").value= "no";
}
}
// Pie Fonction
function pie(val) {
var pi = document.getElementById("display").value.search("/" | "*" | "-" | "+");
if (pi != -1) {
document.getElementById("display").value += val;
}
else {
document.getElementById("display").value = "Please add an operator";
}
}
// Power function : fix so power of any number
function power(val) {
var base = document.getElementById("display").value;
document.getElementById("display").value = base * base;
}
// Log Function
function log(val) {
var vlog = document.getElementById("display").value;
var vloged = Math.log(document.getElementById("display").value);
var v = document.getElementById("display").value = vloged;
if (vlog < 0) {
document.getElementById("display").value= "no";
}
}

function cos(val) {
var vroot = document.getElementById("display").value;
var rooted = Math.sqrt(document.getElementById("display").value);
var r = document.getElementById("display").value = "√" + vroot + "=" + rooted;
}

function sin(val) {
var vroot = document.getElementById("display").value;
var rooted = Math.sqrt(document.getElementById("display").value);
var r = document.getElementById("display").value = "√" + vroot + "=" + rooted;
}

function tan(val) {
var vroot = document.getElementById("display").value;
var rooted = Math.sqrt(document.getElementById("display").value);
var r = document.getElementById("display").value = "√" + vroot + "=" + rooted;
}```
```.calculator {
text-align: center;
}
.display input {
margin-left: 5px;
font-size: 50px;
width: 600px;
height: 100px;
border-radius: 10px;
background-color: rgb(217, 217, 217);
border-color: rgb(230,230,230, .5);
color: rgb(153, 153, 153);
margin-top: 25px;
}

.display input:focus {
outline:0;
}

.button {
background-color: rgb(230, 230, 230, .5);
font-size: 50px;
height: 100px;
width: 100px;
text-align: center;
margin:3px;
color: rgb(153, 153, 153);
border-radius: 10px;
border-color: rgb(230,230,230, .5);
}
.button:hover {
background-color: white;
}

.button:focus {
outline:0;
}

body {
background-color: rgb(204, 204, 204);
}```
```<!DOCTYPE html>
<html>
<head>
<title> Calculator </title>
</head>
<body>

<div class="calculator">
<div class="display">
<input type="text" id="display">
</div>
<div class="main">
<br>
<center>
<table>
<tr>
<td><input type="button" class="button" value="C" onclick='c("")'></td>
<td><input type="button" class="button" value="π" onclick='pie(Math.PI)'></td>
<td><input type="button" class="button" value="√" onclick='root()'></td>
<td><input type="button" class="button" value="^" onclick='power()'></td>
<td><input type="button" class="button" value="*" onclick='insert("*")'></td>
</tr>

<tr>
<td><input type="button" class="button" value="log" onclick='log()'></td>
<td><input type="button" class="button" value="7" onclick='insert(7)'></td>
<td><input type="button" class="button" value="8" onclick='insert(8)'></td>
<td><input type="button" class="button" value="9" onclick='insert(9)'></td>
<td><input type="button" class="button" value="/" onclick='insert("/")'></td>
</tr>

<tr>
<td><input type="button" class="button" value="cos" onclick='cos()'></td>
<td><input type="button" class="button" value="4" onclick='insert(4)'></td>
<td><input type="button" class="button" value="5" onclick='insert(5)'></td>
<td><input type="button" class="button" value="6" onclick='insert(6)'></td>
<td><input type="button" class="button" value="+" onclick='insert("+")'></td>
</tr>

<tr>
<td><input type="button" class="button" value="sin" onclick='sin()'></td>
<td><input type="button" class="button" value="1" onclick='insert(1)'></td>
<td><input type="button" class="button" value="2" onclick='insert(2)'></td>
<td><input type="button" class="button" value="3" onclick='insert(3)'></td>
<td><input type="button" class="button" value="-" onclick='insert("-")'></td>
</tr>

<tr>
<td><input type="button" class="button" value="tan" onclick='tan()'></td>
<td><input type="button" class="button" value="?" onclick='insert("")'></td>
<td><input type="button" class="button" value="0" onclick='insert(0)'></td>
<td><input type="button" class="button" value="." onclick='insert(".")'></td>
<td><input type="button" class="button" value="=" onclick='equal()'></td>
</tr>
</table>
</center>
</div>

</div>
</body>

</html>```

Try to rewrite this line

```var pi = document.getElementById("display").value.search("/" | "*" | "-" | "+");
```

To this:

``` var pi = ["/", "*", "-", "+"].indexOf(document.getElementById("display").value);
```

Excel formula: Cell contains one of many things, To test a cell to see if it contains one of many strings, you can use a formula based on the can use a formula based on the SEARCH, ISNUMBER and SUMPRODUCT functions. NUMBER then returns an array of TRUE / FALSE values: If we have even one TRUE in the array, we know a cell contains at least one of the  Hi there, I am currently using the find function to look for a specific string and then give a response of 1. =(FIND("Dog", A1, 1)) I am trying to find multiple string i.e. =(FIND (OR("Dog","Cat")),A1,1) , but this is having no luck, is it possible to use such a statement to find multiple strings, find Dog OR Cat if true then cell equals "domestic animal.

You should use Array.some for this.

It will return true if your value matches any one of the values from Array else false.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some

Search for a text string and return multiple , You can replace these functions with each other if you are looking for a Search for a text string in a column and return multiple adjacent values This array formula searches for both "Phones" and "Eraser" in column B, if at least one of them is so it successfully searched for aborted in one column and then returned the  H ow do I search multiple strings or words using the grep command? For example I’d like to search word1, word2, word3 and so on within /path/to/file. How do I force grep to search multiple words? How can I grep for multiple patterns on Linux, OS X, FreeBSD, or Unix-like system? What is the command to search multiple words in Linux?

search takes a regular expression. If you are looking for any of those, use /[/*+-]/ as the parameter to search. – Mike McCaughan

He commented it so I don't know how to make it so he solved the question.

How to run grep with multiple AND patterns?, But, at least GNU grep doesn't support this. awk 'NR==FNR{a[\$0];next}{for(i in a​)if(\$0!~i)next}1' patterns - function chained-grep { local pattern="\$1" if [[ -z "\$​pattern" ]]; then cat return fi shift Check if all of multiple strings or regexes exist in a file. How do I grep for multiple patterns with pattern having a pipe character​? This is perfectly valid; the substring can be replaced with one of any length — if shorter, the original string will shrink; if longer, the original string will “expand” in length (similar to typing while in “insert mode” in a text editor or word processor); and if equal, the length of the string remains the same,

Use PRXMATCH function to determine if multiple wor, I need to figure out a way to scan through these variables and flag. Use PRXMATCH function to determine if multiple words are in a string? both appear in any order in at least 1 of the 5 narrative text fields. Or you can check the syntax of the FINDW function, and find out how you should specify the  If we have even one TRUE in the array, we know a cell contains at least one of the strings we're looking for. The easiest way to check for TRUE is to add all values together. We can do that with SUMPRODUCT, but first we need to force the TRUE / FALSE values to 1s and 0s with a double negative (--) like this:

14 Strings, Multiple strings are often stored in a character vector, which you can create with c​() : We'll start with very simple regular expressions and then gradually get more and I want to find the name of a function that's a component of other functions. Contain one letter repeated in at least three places (e.g. “eleven” contains  To search for files containing all the words in any order anywhere: The first grep kicks off a recursive search (r), ignoring case (i) and listing (printing out) the name of the files that are matching (l) for one term ('action' with the single quotes) occurring anywhere in the file.

Better Ways of Comparing a JavaScript String to Multiple Values, Here's the situation: 1) You have a string in JavaScript, like var fruit = ''. Let's look at some other ways of accomplishing the same check. We can use this to create an array on the fly, then see whether the value matches one of the values in the array: Array.prototype.contains = function(obj) { return this. My string masks are stored in a configuration table. The old code had each one hard-coded. This was not an elegant solution for changing values and would require change control protocols if I had any new values.

##### Comments
• The stuff passed to a search method `document.getElementById("display").value.search("/" | "*" | "-" | "+")` doesn't work as you may expect. It's a bitwise or operator, and is a part of boolean arithmetic haha :)
• `search` takes a regular expression. If you are looking for any of those, use `/[\/*+-]/` as the parameter to `search`.
• It still triggers the else statement when there's numbers on the display