extract string have dot using regex substr oracle [closed] - regex

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 months ago.
Improve this question
Input string:
(select FRL_ATTRIBUTE_DESCRIPTION from FRL_ATTRIBUTES WHERE FRL_ATTRIBUTE_LEVEL =9 AND FRL_Lines_PL.FRL_ATTRIBUTE_09 = FRL_ATTRIBUTE)
Ouput :
FRL_Lines_PL.FRL_ATTRIBUTE_09
i need to extract FRL_Lines_PL.FRL_ATTRIBUTE_09 alias name string using regex_substr

You said you want to extract a string that contains a dot and provided example. OK, if that's exactly what you have & need, then
SQL> with test (col) as
2 (select '(select FRL_ATTRIBUTE_DESCRIPTION from FRL_ATTRIBUTES WHERE FRL_ATTRIBUTE_LEVEL =9 AND FRL_Lines_PL.FRL_ATTRIBUTE_09 = FRL_ATTRIBUTE)' from dual)
3 select regexp_substr(col, '\w+\.\w+') result
4 from test;
RESULT
-----------------------------
FRL_Lines_PL.FRL_ATTRIBUTE_09
SQL>

Related

Split string by word contain space in Java [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 months ago.
Improve this question
I have a String pattern: "hh:mm:ss dd:MM:yyyy to hh:mm:ss dd:MM:yyyy" and I want to extract date String from it.
Example:
S = "00:00:00 19/08/2022 to 23:59:59 19/08/2022"
Split into S1 = "00:00:00 19/08/2022" and S2 = "23:59:59 19/08/2022".
I'm trying to use String.split function but can't figure out the regex yet. Can somebody help?
I'm using Java 8.
Just split on \s+to\s+:
String pattern = "00:00:00 19/08/2022 to 23:59:59 19/08/2022";
String[] parts = pattern.split("\\s+to\\s+");
System.out.println(Arrays.toString(parts));
This prints:
[00:00:00 19/08/2022, 23:59:59 19/08/2022]

how to add whitespace before certain characters or words in google sheet [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I have a google sheet where i have long text string in each cell.
following is one of the text string
VACANCY...Test Hotels is hiring for the below position.#Job_Title : Director of a Revenue/ Revenue Manager#Hotel_Name : Signature Hotel#Job_Location : Dubai#Nationality : Selective#Experience : Mandatory hotel experience#Salary_Range : Unspecified#Benefits : Unspecified- Candidate should be currently in UAE and has relevant UAE Hotel experience.Please specify “Applying Position” in the subject line.Email CV: test#test.com#jobseekers #vacancy #Dubai #jobs #recruiters #hotels #manager #revenue
I want to add white spaces before certain words or character so it look neat . for example i want to add white space before "#", "Salary", " job location" etc.
Ho can i do that
Please be reminded that you have to escape any metacharacter
=REGEXREPLACE(A1,"(#|Salary|job location)"," $1")

How to use regular expression in Hive to extract the second integer? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
Data:
BUY 2 FOR 5(STORES)
BUY 2 FOR 10(STORES)
What I tried:
regexp_extract(DATA, '.*? (\\d+) .*$', 2)
Desired result:
5
10
Like this:
regexp_extract(DATA, '^[^0-9]+?\\d+[^0-9]+?(\\d+)', 1);
or
regexp_extract(DATA, '^\\D+?\\d+\\D+?(\\d+)', 1);
Regex means: one or more Non-digits at the beginning, one of more digits, one or more non-digits, and finally the capturing group of digits, you need to extract the group number one.
One more solution is to split string by non-didits and take 2nd element:
select split(DATA, '[^0-9]+')[2];
Or even simpler:
select split(DATA, '\\D+')[2]; --\\D+ means one or more non-digits

Find and Replace , between 2 characters [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
So I have a CSV file with some anomaly for eg
2019-07-25 00:00:00,1014488,2019-07-25 12:24:12,112629,Amy,Flutmus,84004,GM,0001,2.99,312,FFO & CS PLATE ||22,10999,90027,90062||Sand w/ Options,1,0,0.2,18.85,0,1
i want to replace , between these characters || ||.
So I'm expecting
2019-07-25 00:00:00,1014488,2019-07-25 12:24:12,112629,Amy,Flutmus,84004,GM,0001,2.99,312,FFO & CS PLATE ,22,*10999*90027*90062,Sand w/ Options,1,0,0.2,18.85,0,1
You could use re.sub to capture all your strings between || and then replacing the ,s with *s:
import re
value = "2019-07-25 00:00:00,1014488,2019-07-25 12:24:12,112629,Amy,Flutmus,84004,GM,0001,2.99,312,FFO & CS PLATE ||22,10999,90027,90062||Sand w/ Options,1,0,0.2,18.85,0,1"
pattern = re.compile(r'\|\|(.+)\|\|')
cleaned_value = pattern.sub(lambda match: match.group().replace(",", "*"), value)
print(cleaned_value.replace(r'||', ','))

I have a string in perl, how do I replace it with the same string but with [ ] around only the numbers? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Example: DATA500 replaced with DATA[500]
This should work. It replaces groups of one or more digits, the "\d+" part, with the captured string surrounded by [], the "[$1]" part.
$a = "bob123bob123";
$a =~ s/(\d+)/[$1]/g;
print "$a";
# bob[123]bob[123]