I need to check a Regular expression [closed] - regex

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"

Related

Match partial string with regex [closed]

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've a little problem with a simple regex.
I'd like a regex to match this simple string (in a xml file) where wsse: could be optional and in particular something like this: < wsse:Username > (wsse is optional).
Could you help me?
Thanks in advance for your kind help!
This will match the username:
<(?:wsse:)?([^>]+)>
Edit:
And to allow for any string before the colon:
<(?:[^:]+:)?([^>]+)>
Although not the ideal solution (as you really should be parsing XML using an XML parser or XSLT), the following will work for you:
<((wsse:)?Username)>(.*)(</\1>)
It will also return 4 groups per match.
Group 3 will return the actual username from within the tags

please assist with this regex [closed]

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.

regex just have 2 items [closed]

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.
here is my web list
mywebsite/
mywebsite/myweb.html
mywebsite/children1
mywebsite/clidrend2
mywebsite/clidrens3
mywebsite/clidrend4
mywebsite/parent1/S2
mywebsite/parent1/S3
mywebsite/parent1/S4
how do I just have
mywebsite/myweb.html
mywebsite/
and ignore the others.
here is my regex
mywebsite/|mywebsite/myweb.html
Done it :-) thanks everyone
^mywebsite\/myweb\.html|mywebsite\/$
Is this what you want as a result?
mywebsite(/m.*|/)
You could try the following, I could be more precise if you show us the regex you are actually using.
(WhateverYouAreUsing){2}
(...) is a group and {...} is a quantifier, it will take exactly two of the matches you are looking for. {1,2} will take at least one and at maximum two, in case there is only one and you still want to get a match.
Put some parentheses in your regex and escape the .:
(mywebsite/)|(mywebsite/myweb\.html)
Alternatively, for something a little more general:
(\w+/)|(\w+/\w+\.html)

regex select a block of html code? [closed]

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/

Regex: List of Mailadresses [closed]

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