Google Sheets formula to add case-insensitive text + text in cell - regex

I have some text on row A, and I want to write on cell E1 to filter whenever I put this formula
=Filter(A1:A10;ArrayFormula(E1 REGEXMATCH(A1:A10;E1)))
but I want it to CONTAINS not EXACT text
=filter(A1:A10;REGEXMATCH(A1:A10;"(i?) TEX"))
This works but I want to add a cell value
so somehow to combine this to together
I'm trying to put value in cell E1 (?i)TEX and it finds TEXT on A row, but I want to put (?i) in the formula but can't find how to do it.
I tried
=Filter(A1:A10;ArrayFormula(E1 REGEXMATCH(A1:A10;"(i?) +"E1"")))
doesn't work
=Filter(A1:A10;ArrayFormula(E1 REGEXMATCH(A1:A10;"(i?)"+E1)))
doesn't work
=filter(A1:A10;REGEXMATCH(A1:A10;"(i?)&" "&E1"))
doesn't work
I really don't have an idea of how to add (i?) to cell value

To make a match case-insensitive you'll need (?i) instead of (i?). I believe this should work
=filter(A1:A10;REGEXMATCH(A1:A10; "(?i)"&E1))

Related

Conditional Formatting Cells in a Column Only Containing Letters F-Z Excluding RR

How could I highlight cells using conditional formatting if I want to only highlight cells containing letters F-Z? The formula would also need to exclude RR.
For example, if a cell in that column contains RR or any letter from A to E, I don't want to highlight it. But, if it contains any letter from F all the way to Z, I want it automatically highlighted.
Tried using regexmatch, but it's not working.
use:
=REGEXMATCH(A2, "[F-Z]")*(REGEXMATCH(A2, "RR")=FALSE)

Extract a list of unique text characters/ emojis from a cell

I have a text in cell (A1) like this:
โœŒ๐Ÿ˜‹๐Ÿ‘…๐Ÿ‘…โ˜๏ธ๐Ÿ˜‰๐ŸŒ๐Ÿช๐Ÿ’ง๐Ÿ’ง
I want to extract the unique emojis from this cell into separate cells:
โœŒ๐Ÿ˜‹๐Ÿ‘…โ˜๏ธ๐Ÿ˜‰๐ŸŒ๐Ÿช๐Ÿ’ง
Is this possible?
You want to put each character of โœŒ๐Ÿ˜‹๐Ÿ‘…๐Ÿ‘…โ˜๏ธ๐Ÿ˜‰๐ŸŒ๐Ÿช๐Ÿ’ง๐Ÿ’ง to each cell by splitting using the built-in function of Google Spreadsheet.
Sample formula:
=SPLIT(REGEXREPLACE(A1,"(.)","$1#"),"#")
โœŒ๐Ÿ˜‹๐Ÿ‘…๐Ÿ‘…โ˜๏ธ๐Ÿ˜‰๐ŸŒ๐Ÿช๐Ÿ’ง๐Ÿ’ง is put in a cell "A1".
Using REGEXREPLACE, # is put to between each character like โœŒ#๐Ÿ˜‹#๐Ÿ‘…#๐Ÿ‘…#โ˜#๏ธ#๐Ÿ˜‰#๐ŸŒ#๐Ÿช#๐Ÿ’ง#๐Ÿ’ง#.
Using SPLIT, the value is splitted with #.
Result:
Note:
In your question, the value of ๏ธ which cannot be displayed is included. It's \ufe0f. So "G1" can be seen like no value. But the value is existing. So please be careful this. If you want to remove the value, you can use โœŒ๐Ÿ˜‹๐Ÿ‘…๐Ÿ‘…โ˜๐Ÿ˜‰๐ŸŒ๐Ÿช๐Ÿ’ง๐Ÿ’ง.
References:
REGEXREPLACE
SPLIT
Added:
From marikamitsos's comment, I could notice that my understanding was not correct. So the final result is as follows. This is from marikamitsos.
=TRANSPOSE(UNIQUE(TRANSPOSE(SPLIT(REGEXREPLACE(A1,"(.)","$1#"),"#"))))
or try:
=TRANSPOSE(UNIQUE(TRANSPOSE(REGEXEXTRACT(A1, REPT("(.)", LEN(A1))))))
Formula
Appears, one of the best formula solutions would be:
=SPLIT(REGEXREPLACE(A1,"(.)","$1#"),"#")
You may also add some additional checks like skin tones & intermediate chars:
=TRANSPOSE(SPLIT(REGEXREPLACE(A2,"(.[๐Ÿป๐Ÿผ๐Ÿฝ๐Ÿพ๐Ÿฟ"&CHAR(8205)&CHAR(65039)&"]*)","#$1"),"#"))
It will help to join some emojis as a single emoji.
Script
More precise way is to use the script:
https://github.com/orling/grapheme-splitter/blob/master/index.js
โ†‘
Add the code to Script editor
Add code for sample usage:
function splitEmojis(string) {
var splitter = new GraphemeSplitter();
// split the string to an array of grapheme clusters (one string each)
var graphemes = splitter.splitGraphemes(string);
return graphemes;
}
Tests
Not 100% precise
1
Please note: some emojis are not correctly shown in sheets
๐Ÿด๓ ง๓ ข๓ ท๓ ฌ๓ ณ๓ ฟ๐Ÿด๓ ง๓ ข๓ ณ๓ ฃ๓ ด๓ ฟ๐Ÿด๓ ง๓ ข๓ ฅ๓ ฎ๓ ง๓ ฟ๐Ÿด
โ†‘ emojis:
flag: England
flag: Scotland
flag: Wales
black flag
are the same for Google Sheets.
2
Vlookup function in #GoogleSheets and in #Excel thinks chars
#๏ธโƒฃ and
*๏ธโƒฃ
are the same!

If string contains text from list, write matched text to cell

I'm working on a large Google spreadsheet with key phrases, strings of text, in column A. I want to search column A based on a list of keywords that live in another sheet. When a keyword matches a word in a string in column A, I want to print that word in an adjacent cell to column A.
Here's a simple spreadsheet to work with that I think demonstrates what I'm trying to do.
https://docs.google.com/spreadsheets/d/1tNcroABVP0UdP4CiJldxLZgdrJF33TYT4mL1DZJfD1Q/edit?usp=sharing
I want to print that word in an adjacent cell to column A
=ARRAYFORMULA(IFNA(REGEXEXTRACT(A2:A, LOWER(TEXTJOIN("|", 1, 'KEYWORD LIST'!A2:A)))))
Try with this (put at B2):
=arrayformula(if(ISNUMBER(find(
transpose({'KEYWORD LIST'!$A$2:$A$6}),A2:A6)),
transpose({'KEYWORD LIST'!$A$2:$A$6}),""))

Expression for YYYY-MM-DD~Sucess

I have written regex for replacing some text
x.ServiceLogStatus
.replace(/Failed/g,ย "<div class='div1'>\Error</div>")
.replace(/Match not found/g,ย "<div class='div1'>\Error</div>"));
I also want to add another replacement for the pattern.
YYYY-MM-DD
YYYY-MM-DD~Success
How it is possible?
Let say 2001-12-31 i need to replace that date with red color which is inside div.
Let say 2001-12-31~Success, i need to replace that date with red color which is inside div.
What should i do?
Myself fixed it
x.ServiceLogStatusย =ย x.ServiceLogStatus.replace(/(\d+[-/]\d+[-/]\d+)/g,ย "<div class='div2'>\ $1</div>").replace(/(\d+[-/]\d+[-/]\d+)/g,ย "<div class='div4'>\ $1</div>").replace(/~Success/g,ย "<div class='div2'>\ ~Success</div>"));

Regular Expression in ms excel

How can I use regular expression in excel ?
In above image I have column A and B. I have some values in column A. Here I need to move data after = in column B. For e.g. here in 1st row I have SELECT=Hello World. Here I want to remove = sign and move Hello world in column B. How can I do such thing?
Stackoverflow has many posts about adding regular expressions to Excel using VBA. For your particular example, you would need VBA to actually move a substring from one cell to another.
If you simply want to copy the substring, you can do so easily using the MID function:
=IFERROR(MID(A1,FIND("=",A1)+1,999),A1)
I used 999 to ensure that enough characters were grabbed.
IFERROR returns the cell as-is if an equals sign is not found.
To return the portion of string before the equals sign, do this:
=LEFT(A1,FIND("=",A1&"=")-1)
In this case, I appended the equals sign to A1, so FIND won't return an error if not found.
You can use the Text to Column functionality of MS-Excel giving '=' as delimiter.
Refer to this link:
Chop text in column to 60 charactersblocks
You can simply use Text to Column feature of excel for this:
Follow the below steps :
1) Select Column A.
2) Goto Data Tab in Menu Bar.
3) Click Text to Column icon.
4) Choose Delimited option and do Next and then check the Other options in delimiter and enter '=' in the entry box.
5) Just click finish.
Here are URL for Text to Column : http://www.excel-easy.com/examples/text-to-columns.html