Please help with regular expression
HelloWith the help of my previous answers of the detachment, , I've updated the query. But I don't get the answer you want in all cases. Could you please help me? My query is based on the previous announcement. Any other way to do this?
I'd really appreciate it.
select
ltrim ( regexp_substr(txt, '\[(\w+)', 1, level), '[') as id, /* id is number */
ltrim ( regexp_substr(ltrim ( regexp_substr(txt, ':[^]]+', 1, level), ':'), '\w+-*\d*', 1, 1), ':') as qid, /* Qid could be char/number/space any combination except ':' */
ltrim ( regexp_substr(ltrim ( regexp_substr(txt, ':[^]]+', 1, level), ':'), '\w+', 1, 2), ':') as num,
to_date( ltrim ( regexp_substr(ltrim ( regexp_substr(txt, ':[^]]+', 1, level), ':'), '[^:]+', 1, 3), ':'),'MM/DD/YY') as effdate
from (
select '[10946:M100:N:][10947:Q1222:N:][38198:PPP-2:N:][13935:PPP-6:N:][38244:QQQ-4:Y:01/01/10]' as txt
from dual
)
connect by level <= length(regexp_replace(txt, '[^[]'));
I should get:ID QID NUM EFFDATE
10946 M100 N
10947 Q1222 N
38198 PPP-2 N
13935 PPP-6 N
38244 QQQ-4 Y 01-JAN-10
But, beID QID NUM EFFDATE
10946 M100 N
10947 Q1222 N
38198 PPP-2 2
13935 PPP-6 6
38244 QQQ-4 4 01-JAN-10
Thank you
Hello
If the column number is wrong, isn't it?
Describe what should be the num column. For example "num is the 3rd part of :-delimited list placed in square brackets.
If this is what you want, and then change the definition of number of
... ltrim ( regexp_substr(ltrim ( regexp_substr(txt, ':[^]]+', 1, level), ':'), '\w+', 1, 2), ':') as num,
TO
... REGEXP_SUBSTR ( REGEXP_SUBSTR ( txt
, '[^]]+'
, 1
, LEVEL
)
, '[^:]+'
, 1
, 3
) AS num,
Tags: Database
Similar Questions
-
Need help with regular expressions
Hi all
I need your help, because I have no ideas more...
I have the following problem: in the column of the database table, I have the string with the names of files already uploaded to the database. For example: + File1_V01.txt +, + File1_v02.txt +, + File1_01_v01.txt +, etc. The string _vxx * + or _Vxx * + (non-case sensitive) represents the version of the file.
Now the problem: I'll upload the file with the name + File1_v02.txt + (already exists in the table).
If the file name already exists in the table the pl/sql function should get the name of the file with the following version number. In my case it takes + File1_v03.txt +.
Is it possible to do this using SELECT with regular expressions?
Best regards and thanks!with t as ( select 'File_V05.txt' fn from dual union all select 'File_V04.txt' fn from dual union all select 'File2_v03.doc' fn from dual union all select 'File2_v115.doc' fn from dual union all select 'File2_v15.doc' fn from dual union all select 'File1_v03.doc' fn from dual union all select 'File1_v115.doc' fn from dual union all select 'File1_v999.doc' fn from dual union all select 'File2.doc' fn from dual union all select 'File2_v05.doc' fn from dual union all select 'File1_v01.txt' fn from dual union all select 'File1_v02.txt' fn from dual union all select 'File1_v1.txt' fn from dual union all select 'File1_v1.doc' fn from dual union all select 'File1_v2.txt' fn from dual union all select 'File2_v01.doc' fn from dual union all select 'File2_v02.doc' fn from dual union all select 'File1_ABC_v01_DEF.docx' fn from dual union all select 'File1_ABC_V02_ABC.docx' fn from dual union all select 'File1_ABC_v01_12_04_17.docx' fn from dual union all select 'ABC_V1_QWERT.pdf' fn from dual ) select fn, case when fn!=fn_new then last_value(fn_new) over(partition by regexp_replace(upper(fn),'V[[:digit:]]+','') --(.*?V0*)([1-9]+)(\..*?)$ order by nv rows between unbounded preceding and unbounded following ) else fn end fn_new from ( select case when v-1 <= 0 then fn else regexp_replace (fn, '(_v|_V)(\d*)', case when length(substr(fn,v+1,p-v-1)+1) > (p-v-1) then '\1'||to_char(substr(fn,v+1,p-v-1)+1) else '\1'||lpad(substr(fn,v+1,p-v-1)+1,p- v-1,0) end ) end fn_new ,fn ,case when v-1 <= 0 then -1 else substr(fn,v+1,p- v-1)+1 end nv from ( select fn, regexp_instr(upper(fn),'_V[[:digit:]]+',1,1,1) p, instr(upper(fn),'_V')+1 v from t ) ) order by fn FN FN_NEW ABC_V1_QWERT.pdf ABC_V2_QWERT.pdf File_V04.txt File_V06.txt File_V05.txt File_V06.txt File1_ABC_v01_DEF.docx File1_ABC_v02_DEF.docx File1_ABC_v01_12_04_17.docx File1_ABC_v02_12_04_17.docx File1_ABC_V02_ABC.docx File1_ABC_V03_ABC.docx File1_v01.txt File1_v3.txt File1_v02.txt File1_v3.txt File1_v03.doc File1_v1000.doc File1_v1.doc File1_v1000.doc File1_v1.txt File1_v3.txt File1_v115.doc File1_v1000.doc File1_v2.txt File1_v3.txt File1_v999.doc File1_v1000.doc File2.doc File2.doc File2_v01.doc File2_v116.doc File2_v02.doc File2_v116.doc File2_v03.doc File2_v116.doc File2_v05.doc File2_v116.doc File2_v115.doc File2_v116.doc File2_v15.doc File2_v116.doc
-
Hello
I'm just experimenting with regular expressions
My information in table are as shown below
Now, I pulled the following query to find the rows that have 1TABLE NAME: - EMP_TEST STRUCTURE WITH DATA X_NAME --------------------- 12456com ab1245com AXM4554.com
Now, I want to do a query that will give me tose lines that do not have 1select * from emp_test where regexp_like (x_name,'[1]') RESULT AS EXPECTED : - X_NAME --------------------- 12456com ab1245com
Initially I have run the following query
After a bit of searching on Google I found an application that works as expectdselect * from emp_test where regexp_like (x_name,'[^1]') RESULT NOT AS EXPECTED : - X_NAME --------------------- 12456com ab1245com AXM4554.com
Where my basic question is that all seeking a 1 in a row we do not put the beginning ^ end $ and so on and theselect * from emp_test where regexp_like (x_name,'^[^1]*$') RESULT AS EXPECTED : - X_NAME --------------------- AXM4554.com
Works of query.
So why do [^ 1] does not work as shown, while excluding an amd why is ^ [^ 1] * $ necessary while excluding aHello
Elessar wrote:
So why do [^ 1] does not work as describedBecause regexp_like(str,'[^1]') means: search str who have at least one character that is not 1.
When regexp_like(str,'^[^1]*$') means: search str done characters that are not 1 start (^) at the end ($) -
Need help with regular Expression (RegEx)
Try to wrap your head around a regular Expression for the following format example: 0022-C-4452 OR 0022-C-4452-C
* The 4 digits are always numbers
* The last 5 digits are alpha numeric
* Last (if used) digit is always 'C' (in reference to the second structure)
Hold the dashes for "auto fill" if possible? This would be in the Custom Format? Sequence of keys? Or Validation? I appreciate any help!
I still think that you did not correctly describe your problem.
1 figures of 4 characters.
Optional separator.
Then 6 alphanumeric characters and ' - '.
OR
1 figures of 4 characters.
Optional separator.
Then 6 alphanumeric characters and ' - '.
Optional separator.
Character 'C '.
Note that the "-" is not a number and not an alphabetic character. It is a white space character.
Try:
function {MyRe (cString)
var cFormatted = "";
var RE_MyCode0 = /^(\d{4})[-.]) {0,1} ([A-Za-a0 - 9-] {6}) $/;
var RE_MyCode1 = /^(\d{4})[-.]) {0,1} ([A-Za-a0 - 9-] {6}) [-.] {0,1} ([C]) $/;
If (RE_MyCode0.test (CString) == true) {}
cFormatted = RegExp. $1 + '-' + RegExp. $2;
}
If (RE_MyCode1.test (CString) == true) {}
cFormatted = RegExp. $1 + '-' + RegExp. $2 + '-' + RegExp. $3;
}
Return cFormatted;
} / / end of MyRe function;some tests;
var MyString = "0022-C-4452; good channel;
Console.println ("Input:" + MyString);
Console.println ("result:" + MyRe (MyString));var MyString = "0022-C-4452-C; string of Goo;
Console.println ("Input:" + MyString);
Console.println ("result:" + MyRe (MyString));var MyString = "A022-C-4452" / / bad string;
Console.println ("Input:" + MyString);
Console.println ("result:" + MyRe (MyString));var MyString = '0022-4452-CZ' / / bad string;
Console.println ("Input:" + MyString);
Console.println ("result:" + MyRe (MyString)); -
Need help with regular expression
I have a string like: separation by a comma as G, H, L
the table has values like this
Col1 Col2
ROW1 G
ROW2 F
ROW3 L
What is trying to achieve is to find out if G or H or L in the string of separated by commas are in col2. is it possible by using regular expressions or not we do split and the loops?
Thanks in advance.Hello
ora1001 wrote:
I have a string like: separation by a comma as G, H, Lthe table has values like this
Col1 Col2
ROW1 G
ROW2 F
ROW3 LWhat is trying to achieve is to find out if G or H or L in the string of separated by commas are in col2. is it possible by using regular expressions or not we do split and the loops?
Thanks in advance.
You don't even need regular expressions
INSTR ( ',' || col1 || ',' , ',' || col2 || ',' )
will be greater than 0 if (and only if) co12 is one of the elements of col1.
If you're curious, a way of using regular expressions is
REGEXP_LIKE ( col1 , '(^|,)' || col_2 || '($|,)' )
but it will be less effective than Instr.
Published by: Frank Kulash, November 5, 2010 11:38
-
Please help with download. ?
Please help with the download?
Available downloadable Setup files:
- Suites and programs: CC 2015 | CC 2014 | CC | CS6 | CS5.5 | CS5 | CS4, CS4 Web Standard | CS3
- Acrobat: DC, XI, X | 9,8 | 9 standard | 8 standard
- Captivate: 8 | 7 | 6 | 5.5, 5 | 1
- Cold Fusion: 11: 10 | 9.0.2 version 9.0.0, 9.0.1, 8.0.1, 8.0.0, 7.0, 6.1, 6.0, 5.0, 4.0
- Contribute: CS5 | CS4, CS3 | 3,2
- FrameMaker: 12, 11, 10, 9, 8, 7.2
- Lightroom: 6| 5.7.1| 5 | 4 | 3
- Photoshop Elements: 14 | 13 | 12 | 11, 10 | 9,8,7 win | 8 mac | 7 mac
- Premiere Elements: 14 | 13 | 12 | 11, 10 | 9, 8, 7 win | 8 mac | 7 mac
Download and installation help links Adobe
Help download and installation to Prodesigntools links can be found on the most linked pages. They are essential; especially steps 1, 2 and 3. If you click on a link that does not have these listed steps, open a second window by using the link to Lightroom 3 to see these "important Instructions".
-
Get error 207 trying to download creative Cloud and someone please help with this problem, thanks in advance please.
Please refer to
-
I need to reactivate Photoshop CS4 because I have a new hard drive in a reminder for my 2.5 yr old iMac last operating system running. When you open the program, I was told to contact Adobe support and give them an error code: 150:30. Please help with permission. ?
You can repair it yourself. I have a screenshot guide. You use app the Mac Terminal and a python (.py) script that comes with the recovery of the license for the Mac package.
Don't forget to leave a space after typing sudo python and note that your password will not display any points. Simply enter it blind.
Start 11 Message and take your time. It does not work. Layout error 150:30 opening Photoshop cs4 on Macbook Pro
Gene
-
Mask a number with regular expressions
Hi @ll!
Is it possible to hide a given number
of "12345678" in "XXXX5678".
or '987458' to 'XX7458 '.
with Regular Expressions and without substr()? To display only the last four digits and the 'X' value for the rest. The size of the number is not always the same.Alex, I think the OP wanted the first 4 characters to hide ;)
Something like that?
select translate(substr('12345678',1,length('12345678')-4),'1234567890','XXXXXXXXXX') || substr('12345678',length('12345678')-3) from dual / TRANSLAT -------- XXXX5678
More
with test_data as ( select '12345678' card_no from dual union all select '123456' from dual union all select '5678900' from dual ) -- End of test data select translate(substr(card_no,1,length(card_no)-4),'1234567890','XXXXXXXXXX') || substr(card_no,length(card_no)-3) from test_data / TRANSLATE(SUBSTR ---------------- XXXX5678 XX3456 XXX8900
Arun-
-
Problem with regular Expression
Hello!!
I have a problem with the regular expression. I want to validate only one word, and second are the same. To do this, I wrote a regex
Model p=Pattern.compile("([a-z][a-zA-Z]*)\\s\1");
Matcher m = p.matcher ("nikhil nikhil");
Boolean t = m.matches ();
If (t)
System.out.println ("it's a game");
on the other
System.out.println ("is no match);
The result I get is always 'there no match. "
Your timely help will be very appreciated.
ConcerningHello.
You are missing a slash in the regex
Pattern p = Pattern.compile("([a-z][a-zA-Z]*)\\s\\1"); Matcher m = p.matcher("nikhil nikhil"); boolean t = m.matches(); if (t) { System.out.println("There is a match"); } else { System.out.println("There is no match"); }
-
HP Pavilion P7-1110: Please help with editing after scanning
I know how to analyze an element, but after that I scan I do not know how to edit. I have Micro Soft Word 10 and my scanner is a HP Officejet 4630. If you can please help and thank you.
Hi Tadpolegreen,
Thank you for answering my questions!
I would recommend going by there how to scan guide Scan in Windows 7 with full functionality software HP for HP Multifunction printers. Select how to scan with the HP software and how to scan in the form of editable text (OCR), follow the instructions.
I hope this helps!
-
Please help with my reader prs 505
Hi thr,.
Please help me on my prs 505 reader, the display got very light canoe even read the words correctly, what's wrong with it, please help
Thank you
Jeevani
Hi Jeevani,
Welcome to the community of Sony!
Sony Electronics apologizes for any question, you have met with your product. A small number of E Ink devices, with specific display panels, can become sensitive to the discoloration of the display when a page is turned while watching in strong direct sunlight. Clear the display is only temporary and can be corrected by adjusting the angle of the camera to avoid direct light from the Sun and then a page turns.
Also, try the steps on the below technical support article:
http://www.KB.Sony.com/selfservice/documentLink.do?externalId=C1008817
Thank you for your message.
-
Please help with if, then formula
I'm having troble with so and so, please help. So here's my question, if E is less than or equal to 30, then multiply K by 12% and specify the amount of 12% at Mr. Merci for your help and please show me the formula.
Do you mean something like this?
The formula in the column N:
= IF(E≤30,K*12%,"")
You do not specify what you want if the value of E is > 30, so the formula here is nothing. If you want something, then replace ' ' to the desired value.
SG
-
Very slow Macbook Pro (2012), please help with report EtreCheck
Hi all
My Macbook runs very slowly, I tried a number of things suggested online but none worked. I recently went to a repair shop and they suggested it could be to do with the dataflex (not sure if this was exactly, but I remember it sounding similar.) They described as a hard drive to another internal component connection, sorry for the inaccuracy.) I have me am replaced, but this did not help either.
I downloaded the software EtreCheck and I was wondering if someone could help me to make light of the report on possible solutions? I have the feeling that it could be the hard drive needs to be replaced, but have no evidence of that. Verification has been run for the problem of "Beachballing" and got the sub report, please let me know if more info would be helpful. I hope it's telling in a way!
Thank you for the pointers.
EtreCheck version: 2.7.8 (238)
Report generated 2016-01-26 22:56:56
Download EtreCheck from http://etrecheck.com
Duration 10:23
Performance: Poor
Click the [Support] links to help with non-Apple products.
Click [details] for more information on this line.
Problem: Beachballing
MacBook Pro (13-inch, mid-2012)
[Data sheet] - [User Guide] - [Warranty & Service]
MacBook Pro - model: MacBookPro9, 2
1 2.5 GHz Intel Core i5 CPU: 2 strands
4 GB of RAM expandable - [Instructions]
BANK 0/DIMM0
OK 2 GB DDR3 1600 MHz
BANK 1/DIMM0
OK 2 GB DDR3 1600 MHz
Bluetooth: Good - transfer/Airdrop2 taken in charge
Wireless: en1: 802.11 a/b/g/n
Battery: Health = Normal - Cycle count = 420 - SN = 9G22603YVD3MB
Graphics Intel HD 4000
Color LCD 1280 x 800
OS X Mavericks 10.9.5 (13F34) - since startup time: less than an hour
Disk0 APPLE drive HARD TOSHIBA MK5065GSXF: (500,11 GB) (rotation)
EFI (disk0s1)
: 210 MB Macintosh HD (disk0s2) /: 499,25 go-go (248,48 free)
HD (disk0s3)
[recovery] recovery: 650 MB OPTIARC DVD RW AD - 5970H)
Apple Inc. FaceTime HD camera (built-in)
Apple Inc. Apple keyboard / Trackpad
Computer, Inc. Apple IR receiver.
Apple Inc. BRCM20702 hub.
Apple Inc. Bluetooth USB host controller.
Apple Inc. Thunderbolt_bus.
Mac App Store and identified developers
[failure] com.apple.maspushagent.plist [details]
com.Apple.Security.syspolicy.plist [failure]
[loading] com.google.keystone.agent.plist [Support]
[loading] com.oracle.java.Java - Updater.plist [Support]
[loading] com.adobe.fpsaud.plist [Support]
[loading] com.google.keystone.daemon.plist [Support]
[loading] com.oracle.java.Helper - Tool.plist [Support]
iTunesHelper Application (/ Applications/iTunes.app/Contents/MacOS/iTunesHelper.app)
[ongoing] com.etresoft.EtreCheck.85920
FlashPlayer - 10.6: Version: 19.0.0.226 - SDK 10.6 [Support]
QuickTime Plugin: Version: 7.7.3
Flash Player: Version: 19.0.0.226 - SDK 10.6 obsolete! Update
Default browser: Version: 537 - SDK 10.9
o1dbrowserplugin: Version: 5.41.0.0 - SDK 10.8 [Support]
googletalkbrowserplugin: Version: 5.41.0.0 - SDK 10.8 [Support]
JavaAppletPlugin: Version: 25 check the version of Java 8 update
Flash Player [Support]
Java [Support]
TeXDistPrefPane [Support]
Time Machine not configured!
6% update_dyld_shared_cache
4% WindowServer
3% kernel_task
mdworker (3) 2%
1% launchd (4)
Top of page process of memory: ⓘ
508 MB com.apple.WebKit.WebContent (4)
502 MB kernel_task
Safari of 283 MB
Finder 197 MB
152 MB softwareupdated
988 MB of free RAM
3.03 GB used RAM (750 MB cache)
Used Swap 0 B
26 January 2016, 21:59:30 self-test - spent
Hello mrdivorce,
It looks like of course as evidence of a hard drive failing for me. Hard drives 2.5 "in the MacBook Pro tend to fail after 2-3 years. Judging by the date on your MacBook, I think that your time is up. Maybe try to find a different repair store. Looking for Service Center authorized Apple (https://locate.apple.com/).
I suggest upgrading to an SSD and increasing your RAM too. Then you have the hardware to run the last OS X 10.11.
-
I need help to figure out why my outlook express does not work when I try to send a link, or email. I have a dell dimension 4700 xp restored. The error message cannot find the server with an error code number. I am a newbee so one who responds to it will have to break it down for me. So far, I had lots of help from proceeding to audio and graphics, and I am totally grateful for the help I get.
Thank you, Gina Davis
I have
He has already worked with Outlook Express? Using OE? Hotmail is a Webmail service.
How to add your Hotmail e-mail account to Microsoft Outlook Express
http://windowslivehelp.com/solution.aspx?SolutionID=99d4b13d-13dB-40D8-9cdf-172002d4194cIf you don't want to use OE to access Hotmail and want to just use IE to access Hotmail, then just copy the link and paste it into a new message from Hotmail.
Maybe you are looking for
-
Disable the feature of switching to tab, when you click on a link
When I click on certain links particularly in gmail, for example, if I get an email from youtube of a video being downloaded and I click on the video says, firefox opens this link in a new tab, but the problem is that it will automatically switch to
-
problems with update iOS 9.3 car bluetooth
problems with update iOS 9.3 car bluetooth. break and cannot hear the caller voice calls.
-
Connect LabVIEW with a via USB pic 18f4550
Hello everyone, as the title suggests, I would like to have communication with the PHOTO above, in order to to use as a sort of buffer control. Nothing complicated or fancy, I would use it as a sort of buffer, with LV, do all the calculations and lif
-
This addrest is being monitored?
My email address is monitored
-
Silverlight UN-installing with Live Essentials 2011?
Installed Live Essentials 2011 on laptop. After several reboots, clicking on the video link @ MSN.com (in IE) Very surprised by pop up by inviting me to "...". install Silverlight' (yet?) Anyone idea how these re - install invitations should I expect