I have cells containing data in google spreadsheet as quantity of some entity and I wish to extract only that string which is after the quantity value (number).
Example, If my data is :
learn 10 functions
Watch 3 YT tutorial videos
complete 10 charts
I want the result as :
functions
YT tutorial videos
charts
try:
=INDEX(IFNA(REGEXEXTRACT(A1:A, "\d+ (.+)")))
Assuming that you don't have multiple numbers occurrences in the text, you can use this regex.
(?<=\d\s).+$
This regex will match all characters after a number followed by a single space to the end of the line.
Regex Demo
Related
I am creating a mapping data flow where I have a phone number column which can contain values like
(555) 555-1234 or
(555)555-1234 or
555555-1234
I want to extract numbers from this value. How can that be done. I have tried the below function with different variations but nothing is working.
regexExtract("(555) 555-1234",'\d+)')
regexExtract("(555) 555-1234",'(\d\d\d\d\d\d\d\d\d\d)')
Because you have multiple phone formats, you need to remove parentheses and spaces and dashes so you need multiple statements of regexExtract which will make your solution complicated.
instead, i suggest that you use regexReplace, mainly keeping only digits.
i tried it in ADF and it worked, for the sake of the demo, i added a derived column phoneNumber with a value: (555) 555-1234
in the derived column activity i added a new column 'validPhoneNumber' with a regexReplace value like so:
regexReplace(phoneNumber,'[^0-9]', '')
Output:
You can read about it here: https://learn.microsoft.com/en-us/azure/data-factory/data-flow-expressions-usage#regexReplace
I am new to regex and having difficulty obtaining values that are caught in between spaces.
I am trying to get the values "field 1" "abc/def try" from the sameple data below just using regex
Currently im using (^.{18}\s+) to skip the first 18 characters, but am at at loss of how to do grab values with spaces between.
A1234567890 field 1 abc/def try
02021051812 12 test test 12 pass
3333G132021 no test test cancel
any help/pointers will be appreciated.
If this text has fixed-width columns, you can match and trim the column values knowing the amount of chars between start of string and the column text.
For example, this regex will work for the text you posted:
^(.*?)\s*(?<=.{19})(.*?)\s*(?<=^.{34})(.*?)\s*(?<=^.{46})
See the regex demo.
So, Column 2 starts at Position 19, Column 3 starts at Position 34 and Column 4 (end of string here) is at Position 46.
However, this regex is not that efficient, and it would be really great if the data format is fixed on the provider's side.
Given the not knowing if the data is always the same length I created the following, which will provide you with a group per column you might want to use:
^((\s{0,1}\S{1,})*)(\s{2,})((\s{0,1}\S{1,})*)(\s{2,})((\s{0,1}\S{1,})*)
Regex demo
Sample sheet.
As the title says, given a column of arbitrary number of words of arbitrary length, Want a single ArrayFormula to get the first letters of all words in the said column.
I have tried two methods, seen in sample sheet.
1) Using SPLIT and ARRAYFORMULA, can get it one cell but cannot extend down column.
2) Using 2 REGEXEXTRACT, can get for first 2 initials and extend down
But is it possible to get for arbitrary number of words for whole column using ArrayFormula.
Is it possible to use REGEXEXTRACT to return the first letters of many words?
This replaces every word with the captured first letter
=ARRAYFORMULA(UPPER(REGEXREPLACE(A1:A6,"(\w)\S*\s?","$1")))
Here is the deal,
I want to allow user to enter this kind of entries in my price column:
1 or 1234 or 1234,1 or 1234,1234 ...
So I've used this regex which works fine with REGEX101's website
^\d+(,\d+)?$
https://regex101.com/r/D5dAXx/1
only problem is that it doesn't work well with Google spreadsheet's function REGEXMATCH
=REGEXMATCH(TO_TEXT(C2), "^\d+(,\d+)?$")
for example this entries do not match
1
12
1,123
when this entries matches correctly
1,1
1,12
Why is that and what could be the correct REGEX?
My problem was a bad format on the column.
When I entered:
12,1234
the format turned it into
12.1234
which was not matching my REGEXMATCH.
This means data validation criterion comes after the formatting in google's spreadsheets
I am trying to extract a specific text from an Outlook subject line. This is required to calculate turn around time for each order entered in SAP. I have a subject line as below
SO# 3032641559 FW: Attached new PO 4500958640- 13563 TYCO LJ
My final output should be like this: 3032641559
I have been able to do this in MS excel with the formulas like this
=IFERROR(INT(MID([#[Normalized_Subject]],SEARCH(30,[#[Normalized_Subject]]),10)),"Not Found")
in the above formula [#[Normalized_Subject]] is the name of column in which the SO number exists. I have asked to do this in oracle but I am very new to this. Your help on this would be greatly appreciated.
Note: in the above subject line the number 30 is common in every subject line.
The last parameter of REGEXP_SUBSTR() indicates the sub-expression you want to pick. In this case you can't just match 30 then some more numbers as the second set of digits might have a 30. So, it's safer to match the following, where x are more digits.
SO# 30xxxxxx
As a regular expression this becomes:
SO#\s30\d+
where \s indicates a space \d indicates a numeric character and the + that you want to match as many as there are. But, we can use the sub-expression substringing available; in order to do that you need to have sub-expressions; i.e. create groups where you want to split the string:
(SO#\s)(30\d+)
Put this in the function call and you have it:
regexp_substr(str, '(SO#\s)(30\d+)', 1, 1, 'i', 2)
SQL Fiddle