To delete the characters only at the beginning of a string using regexp_replace
I want to be able to delete the characters in a string only until the first numeric value. If it takes place after the digital, I want to keep them.
"for example"AB1234' becomes '1234', 'AB1234C' becomes ' 1234 C.
It might be also spaces and other types of characters at the beginning. I tried this:
Select
regexp_replace ('ABC1234', ' [^ [: digit:]]').
regexp_replace ('AB 1234',' [^ [: digit:]]').
regexp_replace ('AB 01234',' [^ [: digit:]]').
regexp_replace ('AB1234C', ' [^ [: digit:]]').
regexp_replace ('^ 1234', ' [^ [: digit:]]').
regexp_replace ('* #1234Z ',' [^ [: digit:]]')
OF THE DOUBLE
For all except "AB 01234' returned '1234' so it retains the digital. For "AB 01234' it returns correctly '01234'
The bad are those with a character after digital, for example "AB1234C".
I know it I'm missing something here, can someone please help with this?
Thank you
SQL> with t 2 as 3 ( 4 select 'ABC1234' str from dual 5 union all 6 select 'AB 1234' str from dual 7 union all 8 select 'AB 01234' str from dual 9 union all 10 select 'AB1234C' str from dual 11 union all 12 select '^1234' str from dual 13 union all 14 select '*#1234Z' str from dual 15 ) 16 select str 17 , regexp_replace(str, '^[^[:digit:]]+') str_new 18 from t; STR STR_NEW -------- -------- ABC1234 1234 AB 1234 1234 AB 01234 01234 AB1234C 1234C ^1234 1234 *#1234Z 1234Z 6 rows selected.
Tags: Database
Similar Questions
-
The applications listed under Launchpad, is there a way I can delete the ones I don't use on my MAC Air? I hope that I can free up space.
Start the LaunchPad and hold the option key. The icons will start to shake and an X will appear in the upper corner of some but not all. Click the X to remove the application. Programs that have an X are only purchased/downloaded from the App Store. Integrated programs in Mac OS (like Safari) or programs you have downloaded/purchased elsewhere will not be a X. You should not delete (or move) programs such as Safari and Mail (built-in programs) because the update from Apple guess they were be on your computer in their installation location. Weird things happen if they are moved or deleted.
Programs you don't purchase/download from the App Store can be deleted without the help of the dashboard, but you must be careful about this. Third party programs can be installed in different ways: some come in disk images and are trained in your application forms. These can be moved without danger in the trash. Some are installed using an installation program, and these require a little care to remove. In some cases, they set up items in addition to the program and require a special uninstall program, but this is not true in all cases. I always do the note of programs using a Setup program, so I can make sure I have properly uninstall.
-
Report interactive stripping the spaces at the beginning of a string
Hi guys,.
I try to add spaces at the beginning of a string according to certain criteria in order to get a look "back" to a field (ELEMENT).
I have the following report that works well as a TOAD.
SELECT msib1.segment1 AS MODEL , CASE WHEN PLAN_LEVEL = 0 THEN msib2.segment1 WHEN PLAN_LEVEL = 1 THEN ' '||msib2.segment1 WHEN PLAN_LEVEL = 2 THEN ' '||msib2.segment1 WHEN PLAN_LEVEL = 3 THEN ' '||msib2.segment1 END COMPONENT , ds.plan_level FROM xxmel_cpe_bom_view_snapshot ds , mtl_system_items_b msib1 , mtl_system_items_b msib2 WHERE ds.model_item_id = msib2.inventory_item_id AND msib1.organization_id = 24 AND ds.component_item_id = msib1.inventory_item_id AND msib2.organization_id = 24
It works as expected in TOAD, but when I paste the SQL code in the source for interactive report that the report lacks space.
Any help would be appreciated.
Thank you
Chris
Instead of a space, use a   character, given that you work with a browser with APEX...
Thank you
Tony Miller
Software LuvMuffin
-
Zero readings of strain at the beginning of a test using the Daq Assistant
I worked on code that uses the wizard daqmx for reading and writing of strain, temperature and voltage of a cdaq-9174, with NI 9211 and NI 9237 cards. Everything works fine in the code, but I want to be able to zero distortion at the beginning of a test data.
I tried to create a way to make sure I click a button, and it will be zero only strain as an autobalance data. Anyone have any suggestions on how to achieve this?
Hi Fwowe,
As I understand it, you're trying to have is a flaw. I have programmed a small VI than acomplishes this task.
Take a look and tell me what you think.
Best regards!
Carlos O
Technical sales engineer
National Instruments
-
delete the consecutive occurrence of string
version: Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production
Hi I want to do, remove the consecutive occurrence of string
I tried the code below works fine, but I wanted to do this by using the Regexp or any other method betterExample I/P: 'POWELL POWELL BRIAN K AND BONNIE POWELL JARRELL JARRELL' to O/P : 'POWELL BRIAN K AND BONNIE POWELL JARRELL'
WITH T AS ( SELECT LEVEL RN, REGEXP_SUBSTR ( 'POWELL POWELL BRIAN K AND BONNIE POWELL JARRELL JARRELL', '[^ ]+', 1, LEVEL ) NAME FROM DUAL CONNECT BY LEVEL <= LENGTH(REGEXP_REPLACE ( 'POWELL POWELL BRIAN K AND BONNIE POWELL JARRELL JARRELL', '[^[:space:][:punct:]]*' )) + 1) SELECT LISTAGG (NAME, ' ') WITHIN GROUP (ORDER BY Rn) AS name FROM (SELECT RN, NAME, LEAD (NAME, 1, 0) OVER (ORDER BY RN) Lead_name FROM T) WHERE name != lead_name;
Hello
1006112 wrote:
Hello
The solution does not work for this channel.SELECT REGEXP_REPLACE ('ZHOU JIANCHUAN AND ESTABROOK- ZHOU DESIREE ','([^ ]+)( \1)+', '\1') Word1, regexp_replace('ZHOU JIANCHUAN AND ESTABROOK- ZHOU DESIREE', '(\w+)(\W+\1)+', '\1')Word1, regexp_replace('ZHOU JIANCHUAN AND ESTABROOK- ZHOU DESIREE', '(\w+\W+)\1+', '\1')Word3 from dual ; SELECT REGEXP_REPLACE ('STATTELMAN J J JR AND MARGAR ','([^ ]+)( \1)+', '\1') Word1, regexp_replace('STATTELMAN J J JR AND MARGAR', '(\w+)(\W+\1)+', '\1')Word1, regexp_replace('STATTELMAN J J JR AND MARGAR', '(\w+\W+)\1+', '\1')Word3 from dual
Your original solution looking better all the time! This problem is more complicated than I thought.
It is probably more effective than CONNECT BY:SELECT TRIM ( REGEXP_REPLACE ( REGEXP_REPLACE ( ' ' || REPLACE ( str , ' ' , ' ' ) || ' ' , ' ([^ ]+)( +\1)+ ' , ' \1' ) , ' +' , ' ' ) ) AS no_consecutive_dups FROM table_x ORDER BY str ;
I tested it using this table:
CREATE TABLE table_x ( str VARCHAR2 (80) ); INSERT INTO table_x (str) VALUES ('POWELL POWELL BRIAN K AND BONNIE POWELL JARRELL JARRELL'); INSERT INTO table_x (str) VALUES ('ZHOU JIANCHUAN AND ESTABROOK- ZHOU DESIREE '); INSERT INTO table_x (str) VALUES ('STATTELMAN J J JR AND MARGAR'); INSERT INTO table_x (str) VALUES ('DO DO SOL SOL LA LA SOL');
Output:
NO_CONSECUTIVE_DUPS -------------------------------------------------------------------------------- DO SOL LA SOL POWELL BRIAN K AND BONNIE POWELL JARRELL STATTELMAN J JR AND MARGAR ZHOU JIANCHUAN AND ESTABROOK- ZHOU DESIREE
It compresses the spaces; in other words, the original str can contain multiple consecutive spaces or spaces main and/or end, but the output will not.
Here's how it works:
The REGEXP_REPLACE at the heart of this solution search a sequence that begins and ends with a space. otherwise, he'll be fooled by things like "J J JR", where the "J" in "JR" could be confused with a 3rd 'J '. However, this means that a single space between two recurring motifs in 'DO DO GROUND GROUND' can only mark the end of "DOING" pattern or the Spiderbeam of the 'GROUND FLOOR' trend, but not both. The above query that bypasses by replacing all the spaces with 2 spaces, so space may mark the end of 'DOING' and the other may mark the beginning of "GROUND FLOOR". -
Replace the value of property intellectual using regexp_replace
Hi guys,.
What is the best way to change to change the position of third of an IP address using regexp_replace?
For example, to change 192.168.0.1 to 192.168.100.1
Thank you
Manuel VidigalSQL> select regexp_replace('192.168.0.1', '\d+', '100',1,3) ip from dual / IP ------------- 192.168.100.1
-
Select and delete the elements of an array using mouse events
Hello
I am trying to write a code that allows the user to select or remove items from a table to a table in another table. IE, choose what files will be used in later analysis. Selection work ok (using the mouse to select from the table 'files available'), but my deletion section requires an extra mouse click before you update the "trial to use the chart", which causes a lag.
I really don't see why two events are handled differently in what concerns updating the 'trial to use the table.
Help, please!
Thank you
Graham
Graham,
Add an event to the event of value case changed the Stop button. Use it to stop the loop. The way in which your VI is set up two events are necessary after you press Stop until the loop stops. Turn on execution highlighting, and watch what happens to see why.
In addition, the mechanical Action typical for the stop buttons is latch when released.
Why not use a ListBox to tests available with SelectionMode is set to 0 or more items? Its output is an array of indexes of names of point.
Lynn
-
How to remove or delete the line in a string indicator?
I have a string indicator that receives data continuously. If the number of rows in the indicator becomes 100 then receives a new line after the very 1st line 100 line will be removed and so forth... in simple terms, I need to keep only the last/final 100 lines received in the indicator. How can I do this? Kindly help me.
Hello
Please find the attached snapshot.
Hope this helps
Concerning
David
-
I deleted the file from my desktop using Shift + Delete how to recover this file?
Earlier I deleted my desktop using 'Shift + delete' important file how to recover this file?
Please see the thread of the following responses:
How can I recover the files deleted (with shift-delete)
This solution provided by 101 pretty much says it all.
-
Write protection won't let me delete the MP3 from my MP3 using Vista
I am running windows vista Home premium and using Player 2 GB mp3 audio South known work. I can't do anything but open the files that already exist on the with on mp3 player error telling me to remove the disk write protection. This worked fine with XP but not with vista on my pc or laptop. Thanks for any help you have. BTW, this mp3 player has no locks or switch.
Thank youHi KaplanStudent,
First try to run a scan for viruses on your mp3 player and check if the same error.
Second, you can remove the mp3 player ideal protection.
1. connect your mp3 player to your computer.
2. click on Start > calculater.
3. right click on the drive and click Properties > Edit.
4. check the box for the option write .
5 try to delete or copy files.
You can also contact audio South in this regard.
Try these steps and let us know the result.
Kind regards
Bindu S - Microsoft Support
Visit our Microsoft answers feedback Forum and let us know what you think -
How to insert a jump of paragraph and character at the beginning of a paragraph using Grep
Dear community!
I'm stuck...
I have several books in indesign, I need to export to epub. I have a standardized procedure to be able to assign the task to the students.
My problem I have I have a paragraph in style "Title2" and I would break the paragraph before that is of a 'new page '.
This is the theory that I thought about:
-find and change, find the style "Title2".
-Insert a special character + paragraph break before the first character in the paragraph
-with a second discovery and change search the special character
-Replace with nothing and the model with the 'new page '.
My question is how to insert with grep (?) before the first character no matter what.
Please help me!
Thanks in advance
ND
This GREP should add a page preak befor any paragraph:
Find: ^. and set the format to find your title paragraph style
Change of: ~ P $0
That this research is looking for the first character in any paragraph and its replacement by a page break, and himself.
-
Delete the server's CSV file using php
Hi all
I have a link on a site that I created I would trigger php to remove a CSV file which takes place on the server.
Anyone have any ideas?
See you soon
T
http://www.php.net/manual/en/function.unlink.php
http://www.php.net/manual/en/ref.filesystem.php - more functions file.
-
Is it possible to restore, deleted the sticky notes?
Hi, can someone tell me if it is possible to restore, deleted the sticky notes? I use windows 7. Best regards, Peter.
Hello
Follow the steps mentioned below and check if that helps:
(a) navigate to C:\Users\
Directory of Notes \AppData\Roaming\Microsoft\Sticky .(b) right click on StickyNotes.snt,
(c) select restore previous Versions.
This will extract the file from your last restore point, if they are available.
If you close it Sticky Note by right clicking on the taskbar, it closes the application of Sticky Note. However, the next time you open the reminder will return your data. This also applies if you leave sticky noted when you restart your computer.
I hope this helps.
-
I used the destructor of the demo feature PC Tools Performance Toolkit allows you to delete a directory that I couldn't take off any other way. At the same time used a few other functionlities software to clean my computer, the software promised to improve the performance of my computer (Vista). Then I discovered that the software deleted the list of programs recently used in the start which was not desirable. Now there is a list of recently used programs, and a new one is created either. How can I get the list to create again?
Hello
It is not recommended to use any cleaners/tune Up all registry program on modern operating systems.
And they can do more harm to your any good operating system that they claim to be able to do.
See if that helps you.
Do a system restore, if necessary using the safe, before the problem started.
http://bertk.MVPs.org/html/restoresysv.html
How to access Safe Mode
http://www.bleepingcomputer.com/tutorials/how-to-start-Windows-in-safe-mode/#Vista
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Or follow this path:
"Use the System File Checker tool to fix the files of system missing or corrupted on Windows Vista or Windows 7"
http://support.Microsoft.com/kb/929833?WA=wsignin1.0
If SFC is erors that it cannot repair, you may need to do a repair upgrade installation.
But, to a Microsoft Vista DVD, not the valorization of the disc manufacturer.
"How to perform a repair for Vista Installation"
http://www.Vistax64.com/tutorials/88236-repair-install-Vista.html
See you soon.
-
Hello
I deleted the creative cloud of the trial and the DM Dream weaver of the trial, after only using it for about 6 days, I tried to re-download the two tests and nothing happens. Anyone know how I can get this done. Please advise, your help will be greatly appreciated.
Hello
Also see also software Adobe to trial has expired at the beginning
Hope that helps!
Kind regards
Sheena
Maybe you are looking for
-
is there a replacement in the apple service center? I bought it a month ago, and it is guaranteed for 3 years. so, if there is a replacement by a new... apple gives me the same thing with his 3-year warranty? and what about all the pictures and stuff
-
What is the key race to recharge
In safari, the key to reload is Apple + RWhat is main features to reload in Firefox
-
Trying to use and understand the strict type def and def/control type. Thought I heard until I opened the Level.vi of Simulation-Tank delivered w Labview (2014). On the front panel are two Boolean flags. They have been modified to look like symbol
-
The version of Windows7 candidate
-
Mr President, I have vista preinstalled and I formatted now it asks for product key. What can I do now? The sticker that contains the product key is turned pale as I bought it 3 years ago and I have not written the key anywhere elsewhere. Please help