It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I am trying to write a regex for only the text that is in the parenthesis, INCLUDING the parenthesis in the following sentence: ""Here is a house. The house is blue. (12.6)"". So I want to select --> (12.6) <--
Something like:
\(\d+\.\d+\)
This is assuming you'll have only digits in that sub-string, and always in the form: (xy.zd)
Since I have no clue what language, tool, pattern, wtv you're using, I'm just leaving the basic regex.
In JavaScript this regex returns an array of the text items surrounded with brackets:
"Here is a house. The house is blue. (12.6) (3)".match(/\([^\)]*\)/g);
Returns:
["(12.6)", "(3)"]
Cheers.
Related
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
As part of my assignment I have to replace words with at least one numeric with the word STOP, Is there any way of doing it using regex?
Words
a1wew
abc
1rr
sd
Output
STOP
abc
STOP
sd
I am using regex of eclipse in find.
Find:
(?=.*\d)\w+
Replace:
STOP
One possible regex is grep '.*[0-9].*'
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I need to select a block of code so I can remove it using TextSoap.
How can I select everything from the opening "< !DOCTYPE" to the first "< h1>"?
Thanks.
A general regex could look like '^<!DOCTYPE(.|\n)*?<h1>' but like the commenters said correctly, what language are you using? Languages may have different ways of dealing with regexes. You can also try this: http://regexpal.com/
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
\\s*[\\-]?[\\d]{1,3}\\s+[\\-]?[\\d]{1,3}\\s+[\\-]?[\\d]{1,3}\\s+[\\-]?[\\d]{1,3}\\s*
I have this regex for taking in 4 coordinates which are whole numbers (positive or negative). Can you please suggest any bugs in this regex?
If it's a Java regex, then it's correct for matching a string that contains four integer numbers between -999 and 999, separated by whitespace. It's very ugly, though, and could be simplified a lot:
\\s*(?:-?\\d{1,3}\\s+){3}-?\\d{1,3}\\s*
If it's not Java, then you only need one backslash at a time (but you might need other syntax, depending on your language).
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have a excel file that must have this name format, where xxx is a number and yymmdd is a date. Only xxx and yymmdd change, the rest is always the same.
CDFSDDRCxxxCurryymmdd.xls
What is a regex I can use to check if it is correct??
Try with following regex:
^CDFSDDRC\d{3}Curr\d{6}\.xls$
In C# I think you can try something like this :
"CDFSDDRC(?<xxx>[0-9]+)Curr(?<yymmdd>[0-9][0-9][0|1][0-9][0-3][0-9])\.xls"
But you will have to check matches.Groups["yymmdd"].value once more to check for special cases such as CDFSDDRC123Curr321539.xls that match but contains an incorrect date.
I think the following should work.
CDFSDDRC\d[3]Curr(([0-9]{2}(0[13578]|1[02])(0[1-9]|[12][0-9]|3[01]))|([0-9]{2}(0[469]|1[1])(0[1-9]|[12][0-9]|30))|([0-9]{2}(02)(0[1-9]|1[0-9]|2[0-8]))|((((04|08|[2468][048]|[13579][26]))|00)(02)29))\.xsl
I think that you have to escape the backslashes in the C# string.
"CDFSDDRC\\d[3]Curr(([0-9]{2}(0[13578]|1[02])(0[1-9]|[12][0-9]|3[01]))|([0-9]{2}(0[469]|1[1])(0[1-9]|[12][0-9]|30))|([0-9]{2}(02)(0[1-9]|1[0-9]|2[0-8]))|((((04|08|[2468][048]|[13579][26]))|00)(02)29))\\.xsl"
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
input: name <hui.li#xxx.ch>; hans#dhdfhgdfgh <hans.dampf#xxxx>;
Output: e1#mail.com, e2#mail.com, e3#mail.com,e#mail.com
I want to erase the stuff between: >;(?*)< But my regex isn't working.
If >;(?*)< is the Regex you tried, then the question mark is probably wrong. It has no special meaning. Try using >;(.*)< instead and see if thats what you wanted.
you should go another way. Instead of filtering the decoration you should write a regex, that matches only email addresses. Get the result as an array and join it with ", "
To find valid emails there are plenty of expressions out there. More ore less accurate. http://regexlib.com/Search.aspx?k=email