Expression of Reg
Can someone show me a regular expression that would remove everything that is not a number from a string?Thank you
Jeremy
bigj9901 wrote:
> I'm going to use it in a php works, not that good with reg well expressions. Could you give me an idea on how to a filter string and return only the numbers?
Use preg_replace like this:
<>
$string = ' ab34dfg843c3? | 8 D 4# @ " ;
$numbers = preg_replace ('/ \D /', ", $string);
echo $numbers; poster 34843384
?>
' / \D/' is the regular expression. The second argument is a pair of
quotes with nothing between (an empty string). The effect is to
Replace all numbers not by anything.
--
David powers
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "Foundation PHP 5 for Flash" (friends of ED)
http://foundationphp.com/
Tags: Dreamweaver
Similar Questions
-
Hello.. I need assistance with reg expression for my calls (conf)
1866123123 * xxxxxxxx to be replaced by sip:[email protected] / * /
Much appreciated your help...
Tried, but do not replace ^(1866123123**) (\d {8}) with sip:------[email protected] / * / (not working)
Paulo Souza
Please note the answers and mark it as "answered" as appropriate.
-
Dear people, I want only in biens2 GOODS, GOODS1, the following query values
here in future GOODS1... GOODS100 can exist, because it will continue to increasewith t as ( select 'GOODS1' string,100 NUM from dual union all select 'GOODS1' string,200 NUM from dual union all select 'GOODS' string,200 NUM from dual union all select 'GOODS2' string,200 NUM from dual union all select 'GOODSDELL' string,200 NUM from dual union all select 'GOODSDELL2' string,200 NUM from dual union all select 'GOODS2' string,200 NUM from dual ) select STRING,SUM(NUM) from t where string like 'GOODS%' GROUP BY STRING am getting output like below STRING SUM(NUM) ---------- ---------- GOODS1 300 GOODS2 400 GOODSDELL2 200 GOODS 200 GOODSDELL 200 i need only GOODS1 300 GOODS2 400 GOODS 200
Please enlighten us on this
Published by: starting on September 11, 2012 04:38As this can be
where regexp_like(string, 'GOODS[[:digit:]]+')
Note: the code is not tested.
-
Of-Rube my code please Reg Expression maybe?
Hi all!
I will avoid solutions based text, but after looking at my code, I thought I can get a chance to learn a better way to do it.
Problem:
In LV 8.6 there is a problem when an individual 'node' in a VRML file result LV to crash if I try to open a file containing this node.
Solution:
Wirte code to check the file and remove the cruelest bad 'node' of trying to open it.
IF this code works, but screams "This could we better using Reg expression?"
I think the picture tells the story.
NOTE: The case of non-visalbe just do the wires.
THEN, share your thoughts please.
Ben
Even better than my original. This is the beginning of the selection followed until the first byeverything '} ' (and line break).
Kudos to ben64 for the tip.
-
Dear all,
I'm new on reg exp. Could someone give me the reg expression for
This string.
000P * 00000000
where O is digit
* is an alpha charachers
the string is therefore 3 numbers, hard coded P and a character alpha and 8
for example: 123Pa45678981
OR 223Px00000012
the length of the shot must be 13 characters, and no more.
Thank you
Prash
Hello
DPT-Opitz wrote:
} »
+ matches "1 alphabetic characters or more .
To match "any 1" only, lose the +:
} »
-
I have a table called test with the names of column col1, col2.
col1 value: 1234. col2 value: 1547
I need o/p as 14 digits IE common present in the two columns.how to find it using reg expressions.
Hello
Here's another way, according to your needs:
SELECT ename, empno, mgr
, REGEXP_REPLACE (REGEXP_REPLACE ("0123456789")
, '[^' || To_char (empno) | ] »
)
, '[^' || To_char (mgr). ] »
) AS common_digits
FROM scott.emp
ORDER BY ename
;
The output does not include duplicate numbers, and the numbers will be in the order 0, 1, 2,..., 9, like this:
ENAME, EMPNO, MGR COMMON_DIG
---------- ---------- ---------- ----------
7876 7788 78 ADAMS
7499 7698 79 ALLEN
7698 7839 789 BLAKE
7782 7839 78 CLARK
7902 7566 7 FORD
7900 7698 79 JAMES
7566 7839 7 JONES
KING 7839
7654 7698 67 MARTIN
7934 7782 7 MILLER
7788 7566 7 SCOTT
SMITH, 7369 7902 79
7844 7698 78 TURNER
DISTRICT 7-7698-7521
You can get the same results without regular expressions, perhaps more effectively.
-
Validate through the Reg Expression
Hello
I have following requirement through reg expressions.
Need to write a Boolean method that takes a string parameter which should satisfy following conditions.
a string of length o 20 characters.
o 9 first characters will be a number
o next 2 characters are alphabets
o characters 2 next will have a number. (1 to 31 or 99)
o 1 next character will be an alphabet
o the last 6 characters will be a number.
JDev 11.1.1.6.0You can try something like this like regex:
^+[0-9]{9}+[a-zA-Z]{2}+(0[0-9]|1[0-9]|2[0-9]|3[0-1]|99)+[a-zA-Z]{1}+[0-9]{6}$
Dario
-
CFINPUT Reg Expression Model Validation help
I have a form with a non-mandatory field that must meet certain requirements of validation (numbers, letters, 'space' or 'white, empty string' only) if the user chooses to fill...
I use the CFINPUT tag with the following settings, my Expression Reg model seems OK?
REQUIRED = "No".
VALIDATE = 'regular_expression '.
MODEL = "^ [a-zA-Z *] {1,40}" $' "
MAXLENGTH = "40".
Thanks for any help. I'm v. new to regular expressions (10 hrs to Google Univ education.)
Sincerely,
Paul cross
I think you want something more like this:
^ [a-zA-Z0-9] {0.40} $
-
Reg: Doubt in XQuery FLWOR expression
Hello Experts,
I have a XML like this-
< root >
< Reports >
< report >
< ReportName > ABCM < / ReportName >
. . . other details...
< / report >
< report >
< ReportName > XYZZ < / ReportName >
. . . other details...
< / report >
< report >
< ReportName > ABCXO < / ReportName >
. . . other details...
< / report >
< report >
< ReportName > COMO < / ReportName >
.. .other details...
< / report >
< / Reports >
< / root >
I have try it like this.
Select x1.*
Of
test_xml,
XMLTABLE)
' for $i in Root/reports/reports
where $i / ReportName in ('ABCM', 'ABCXO')
Return $i"
in passing test_xml.dx
columns
slno for the ordinalite,
path of varchar2 (15) report_name 'NomRapport. "
sequence_number number path "SequenceNumber".
) x 1
;
My doubt is in the red part above.
I want to go get the details only for reports whose name start with 'ABC '. Even $i / ReportName as 'ABC%' will raise an error
ORA-19114: XPST0003 - error during parsing of the XQuery expression:
LPX-00801: error of XQuery syntax to "like".
2 where $i / ReportName as 'ABC% '.
- ^
19114 00000 - "error during the analysis of the XQuery expression: %s.
* Cause: An error occurred during parsing of the XQuery expression.
* Action: Check the error message for possible causes.
Error on line: column 2:30
Please notify.
Thank you and best regards,
-Nordine
(on Oracle 11.2.0.3.0)
I gave you example ora: matches. It is easy to change it to use fn:starts - with:
with t as)
Select xmltype (')
xmlDoc ') of doubleABCM 1 XYZZ 2 ABCXO 3 JULIE 4 )
Select x1.*
t,.
XMLTable)
"' / Root/reports/reports [fn:starts - with (ReportName,"ABC")].
passage xmldoc
columns
slno for the ordinalite,
path of varchar2 (15) report_name 'NomRapport. "
sequence_number number path "SequenceNumber".
) x 1
/
SLNO REPORT_NAME SEQUENCE_NUMBER
---------- --------------- ---------------
1 ABCM 1
2 ABCXO 3SQL >
SY.
-
How to format a value by using reg expression
Please, I need to format a value using regular expressions.
Result9911223344, 9911223344 9911223344 11223344
Some tips on how I can do this?(99) 1122-3344, (99) 1122-3344 (99) 1122-3344 1122-3344
Kind regardsHello
You were close.
The first 2 digits are optional, so add a '?' in the model.
This means that you will get results like ' ((1122-3344'), so use REPLACE to get rid of unwanted brackets.SELECT REPLACE ( REGEXP_REPLACE ( val , '(\d{2})?' -- ? added here || '(\d{4})(\d{4})' , '(\1) \2-\3' ) , '() ' ) AS formatted_val FROM t ;
This assumes that "()" does not happen in the raw val. If so, use the REGEXP_REPLACE calls; a search of numbers with eactly 8 digits and the other looking for numbers with exactly 10 digits.
-
extract the string reg expression?
How to extract P '89' 84 of this field?
CSOM 50, HON 93, P '89' 84 JASPER YOUR L
The string P I could start anywhere in the string, but is always followed by an apostrophe. It could be any length with a series of apostrophes and the years ending with a white or the end of the field.
I think that regular expressions should solve this problem, but I can't understand it. Any help is appreciated.Hello
Here's one way:
REGEXP_SUBSTR ( txt , 'P' || -- The letter P '(' || -- Begin \1 '''' || -- apostophe '[0-9]+' || -- 1 or more digits (see below for alternative) ')+' || -- End \1, which may occur 1 or more times '( |$)' -- Either space or end-of-string )
If the years must be exactly two digits, then change the line 5 to:
... '[0-9]{2}' || -- exactly 2 digits
-
Hi all
IAM learning reg exp
I have cases where iam trying to check is that the first letter of the string is of type char, which iam (able to)
IAM also able to check for the number, but unable to this looping...
I mean D45GHY iam trying to exract D and 45 but unable to understand how to adapt it in reg exp
D45GHJI of entry on-site D45
D4465GHJI of input D4465 on-site
Entry exit J7 J7GHYT
entry GHHIT J9 output J9
logic is that if the first character is the alphabet (A - Z) and second character is number;
I have to extract to a digital tank is encountered.
can you please think or pass on some readings...Hello
Try:
SELECT REGEXP_SUBSTR('D45GHJI', '^[[:alpha:]][[:digit:]]*[^[:alpha:]]') FROM DUAL; D45 D4465 J7 J9
-
Regular expression matching is not what matches Pattern
I read a lot of posts on how match model does not match what match regular expressions will be due some characters does not.
However, I found a problem with the other way. A simple Reg - Ex who works in the match pattern but not regular Expression match.
What I have here is just an example. I want to use regular Expression Match then I can specify some matches under.
The reg - ex's: one or more non-numeric characters, a space, one or more numeric characters. At the beginning of the string.
How can I get this to work in regular expression matching? I work in LabVIEW 2010f2 32 bit. Here is the code snippet and the results:
Rob
One of the subtle differences is the operator of negation for the character classes. In match pattern is ~, but for the Match RegEx is ^.
-
My email account on outlook express, see below
On my account to outlook express email my friends send me emails and I have the mails there are links to the Web sites or utube videos, but when I click on the link / links, only a page of blannk arrives, so I have to copy and paste the link, then the page comes, how can it be addressed?
Are these links in blue as a link should be? Or are they black? If they're blue, read on...With the permission of MVP Frank Saunders (RIP).If you get a blank page when you click on a link in an email:
1. click on start and then click Run.2. in the Open box, type:regsvr32 urlmon.dll3. click OK and then click on OK again when you receive the following message is displayed:DllRegisterServer in urlmon.dll successful.
4. If that is fixed, see this article:5. If you use Windows XP try this:
http://www.MVPs.org/sramesh2k/reg/IE_Default_Browser.reg
You can also try this:Go to start/run, and then type SFC (msconfig for WinXP).
Choose "Extract one file from installation disk" ("expand file" for WinXP).
Type the file oleaut32.dll, not worry about its location. Then, click Start.Next to ' restore from ', type or browse to the location of the file, which is probably to the Win98 CD-ROM installation folder (generally D:\Win98) (i386 for WinXP), or in your Windows\Options\Cabs (Windows\i386 for WinXP) file, if any.Then, next to "save file in", type C:\Windows\System (C:\Windows\System32 for WinXP), and then click OK. System (or msconfig) File Checker searches the file, saves it as you asked for it and shows that "the file has been extracted successfully."You may need to restart. -
How can I back up Outlook express when I e-mail saved with attachments, under a number of folders in Outlook express? See you soon
original title: backup Outlook express---------------------------
The registry editor
---------------------------
Are you sure you want to add the information in C:\OEQB26DEC2011\AllIdentities.reg to the registry?
---------------------------
Yes No
---------------------------OEQB26DEC2011 is the name of the folder that OEQB saved on. Don't know what that means though?
Everything gets backed up with OEQB including your address book.When you configure OEQB, you created the folder where the backup will be sent to? It seems that everything is OK. Here's some reading for you if it helps.OEQB instructions:
http://www.oehelp.com/OEBackup/oeqb.htm
Maybe you are looking for
-
My Ipad series no is DL * 5YN IMEI: 355890067949300 Product version: 13D 15 Please help please me to get my apple ID and the last that I registered with an ID icloud. SOS Yeshey dema < personal information under the direction of the host >
-
can I buy a Skype to another country number and call people to make look like I am
can I buy a Skype number to another country and call it people what actually looks like I'm calling from that country, while actually being in a completely different country?
-
Apologize to publish new same problem but to reaffirm for clarification. The computer works fine with default (poor) VGA graphics, but stops almost immediately when using Intel HD 3000 graphics. All the equipment tests pass including the motherboard,
-
Problem with drive combo on Satellite P10
I have a model of Satellite P10 - 554 running on XP SP2 version English. My combo drive works great with DVD but when I insert a CD I get this message (and I can't access the drive):"The request could not be performed because of an i/o device error."
-
Scanner LiDE 220 - leave it lit?
I bought a scanner LiDE 220 from Amazon and installed yesterday. So far I like it really - especially the Auto Scan function that figures on what you scan and crop it for you. I love it so much that I ordered another today for my wife's computer. I h