I have a text field and I need to be able to perform a function if that field contains (not equals) the word "Excel". Textfield contains the word Excel
My sample is below
if (this.rawValue== "Excel") <---- instead of = I want something using wildcards before and after the word "Excel"
{
Then do something
}
Else
{
Do something else
};
Views
Replies
Total Likes
Hi,
you can use a regular expression for this task.
if (this.rawValue.match(/\s+Excel\s+/g)) {
...
} else {
...
}
Views
Replies
Total Likes
This only seems to work if I have a white space before and after the word "Excel" I need something that would work like *Excel*.
Views
Replies
Total Likes
Try:
if (this.rawValue.match(/Excel/gi) ...
Views
Replies
Total Likes
Thanks guys, you pointed me the right direction. This is what I have that seems to be working
if (this.rawValue.match(/.*Excel.*/))
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies