google sheets Split Function - google-sheets

I'm trying to split a cell on the 2nd space character. Is this possible? Or is it just possible to split on a space character?
LeBron James SF ORL # CLEThu 7:00pm
LeBron James SF ORL # CLEThu 7:00pm

Please try regular expression:
=REGEXEXTRACT(A1,"^([^ ]+ [^ ]+) (.*)")
(...) (...) is to find 2 groups on a string
^ at the beginning means to look at the start of a string
[^ ]+ means 1+ no space char.
.* means any number of chars
References:
RegexExtract
Regex Syntax

You can use il of individual pieces of the split. For example if 'LeBron James SF ORL # CLEThu 7:00pm' is in A1. In B1 put this:
=index(split(A1," "),0,1)&" "&index(split(A1," "),0,2)
It will return 'LeBron James'. In C1 put:
=index(split(A1," "),0,3)&" "&index(split(A1," "),0,4)&" "&index(split(A1," "),0,5)&" "&index(split(A1," "),0,6)&" "&text(index(split(A1," "),0,7),"hh:mm am/pm")
It will return 'SF ORL # CLEThu 07:00 PM'. Note the use of text to return the time correctly.

A simple way is to SUBSTITUTE the second instance of a space with a character not otherwise in service (I chose £), then SPLIT on that character:
=split(substitute(A1," ","£",2),"£")

Related

Extracting numbers with REGEXEXTRACT that might have a comma or dot

I have a list of numbers in a few formats that may or may not include a dot and a comma. The numbers are locked in a string. For example:
hello 1,000 goodbye
hola 2,000.12 ciao
Hallo 3000.00 Auf Wiedersehen
How can I extract the numbers?
I don't care if the comma is added but the dot is obviously important.
I need the regular_expression to be used in REGEXEXTRACT (and the rest of the REGEX formulas.
The output should be:
1000
2000.12
3000.00
Supposing that your raw data is in A2:A, use this in B2 (or the second cell) of an otherwise empty column:
=ArrayFormula(IF(A2:A="",,IFERROR(VALUE(REGEXEXTRACT(A2:A,"\d[\d,\.]*\d")))))
The REGEX portion reads, in plain English, "Extract any portion that starts with a digit followed by any number of digits, commas or periods (or none of these) and ends with a digit."
You will likely want to apply Format > Number > Currency to the results column.

Lua | String Pattern exclusion

So for I game I want the user to be able to do commands.
For simplicity all parameters are put into a table.
Example: "message all Hello" -> {"message","all","Hello"}
For that I've used the alphanumeric pattern (%w).
Problem is that characters like: _ ; : . Simply can not be used, since they're not alphanumeric.
Is there anyway to use the all characters pattern(.), but ignore spaces.
Or is there any better way to do it?
Thank you for your help
According to Lua docs:
Making the letter after the % uppercase inverts the class, so %D will match all non-digit characters.
So the pattern you're looking for is %S+.

How can I construct a regular expression to account for non-consecutive characters?

I'm currently using this regex for my names \A^[a-zA-Z'.,\s-]*\z; however, I don't want there to be any consecutive characters for a apostrophe, period, comma, whitespace, or hyphen. How can I do this?
The significant part would be (?:[a-zA-Z]|['.,\s-](?!['.,\s-])).
Meaning:
(?:
[a-zA-Z] # letters
| # or
['.,\s-] # any of these
(?!['.,\s-]) # but in front can not be another of these
)
But, in this case:
Guedes, Washington
------^^----------
Would invalidate the name, so maybe you want remove \s from the negative look-ahead.
Hope it helps.
How about this (string of letters, potentially ending with one of those terminator chars)
\A^[a-zA-Z]*['.,\s-]?\z

Extract word or character after matched string excluding whiteSpace and matched string using regex

"1 cup of Greek or natural yoghurt."
I want cup to be filtered out.
"1gm of salt."
Here i want gm to be extracted.
I want a regex expression which is the combination of both.
Any help would be appriciated.
/^(.+?)( cup|gm)(.+?)$/i
replace to
\1 \3
regex101

Ultraedit regex to remove all words which contains number

I am trying to make a Ultraedit regex which allows me to remove all words of a txt file containing a number.
For example:
test
test2
t2est
te2st
and...
get only
test
A case-insensitive search with Perl regular expression search string \<[a-z]+\d\w*\> finds entire words containing at least 1 digit.
\< ... beginning of a word. \b for any word boundary could be also used.
[a-z]+ ... any letter 1 or more times. You can put additional characters into the square brackets like ÄÖÜäöüß also used in language of text file.
\d ... any digit, i.e. 0-9.
\w* ... any word character 0 or more times. Any word character means all word characters according to Unicode table which includes language dependent word characters, all digits and the underscore.
\> ... end of a word. \b for any word boundary could be also used.
A case-insensitive search with UltraEdit regular expression search string [a-z]+[0-9][a-z0-9_]++ finds also entire words containing at least 1 digit if additionally the find option Match whole word is also checked.
[a-z]+ ... any letter 1 or more times. You can put additional characters into the square brackets used in language of text file.
[0-9] ... any digit.
[a-z0-9_]++ ... any letter, digit or underscore 0 or more times.
The UltraEdit regexp search string [a-z]+[0-9][a-z0-9_]++ in Unix/Perl syntax would be [a-z]+[0-9][a-z0-9_]* which could be also used with find option Match whole word checked instead of the Perl regexp search.

Resources