I'm pretty new to using regexes and I can figure out how I would go about extracted a specific number from a string.
Suppose the string was any amount of whitespace or random text and somewhere within it is this, "Value: $1000.00."
In order to retrieve that value I am currently using this:
string value = Convert.ToString(Regex.Match(B...
I want to match an optional tag at the end of a line of text.
Example input text:
The quick brown fox jumps over the lazy dog {tag}
I want to match the part in curly-braces and create a back-reference to it.
My regex looks like this:
^.*(\{\w+\})?
(somewhat simplified, I'm also matching parts before the tag):
It matches the line...
Hello
I have a directory with lots of folders, subfolder and all with files in them. The idea of my project is to recurse through the entire directory, gather up all the names of the files and replace invalid characters (invalid for a SharePoint migration).
However, i'm completely unfamiliar with Regular Expressions. The characters...
Hi,
I am dealing with developing and Application for European Client and they have their native character set.
Now I need to have regex which would allow foreign characters like eéèêë etc and am not sure of how this can be done.
Any Suggestions ?
...
I have regex as /^[a-zA-Z ]+$/ now I need to add support for unicode characters and so am using \p{L} like '/^[a-zA-Z ]+$\p{L}/'.
This is not working for me and I am not sure that this is correct way of using it. I am new to regex and would appreciate any guidance.
Thanks.
...
I'm new to regular expressions in Java (or any language, for that matter) and I'm wanting to do a find using them. The tricky part that I don't understand how to do is replace something inside the string that matches.
For example, if the line I'm looking for is
Person item6 [can {item thing [wrap]}]
I'm able to write a regex that fin...
First, the background: I'm writing a Ruby app that uses SendGrid to send mass emails. SendGrid uses a custom email header (in JSON format) to set recipients, values to substitute, etc. SendGrid's documentation recommends splitting up the header so that the lines are shorter than 1,000 bytes.
My question, then, is this: given a long JS...
Hi,
I have a regex like the following:
.{0,1000}(?!(xa7|para(graf))$)
using Java.
I was expecting that it would cause the following text to fail:
blaparagraf
because paragraf is found at the end
...
There may be an easier way, and if there is I'm all for it. However - my ASP.NET page has a TON of controls on it, and I've given them all ID's that start with underscore. I copied all the markup into Notepad++ and I'm trying to find a regular expression that will find everything but the controls and replace it with whitespace. that w...
Hi, I have this regex for getting the YouTube video ID:
(?<=v=)[a-zA-Z0-9-]+(?=&)|(?<=[0-9]/)[^&\n]+|(?<=v=)[^&\n]+
I get it from there: http://stackoverflow.com/questions/2597080/regex-to-parse-youtube-yid
The problem is I get preg_match() Unknown modifier '[' warning.
I know I have to enclose the regex delimiters but I have no ide...
dear all..i have this code:
<script>
var str="KD-R435MUN2D";
var matches=str.match(/(EE|[EJU]).*(D)/i);
if (matches) {
var firstletter = matches [1];
var secondletter = matches [2];
var thirdletter = matches [3];
alert(firstletter + secondletter + thirdletter);
}else{
alert (":(");
}
</script>
i want it can contro...
How can I extract the content between tags with several line breaks?
I'm a newbie to regex, who would like to know how to handle unknown numbers of line break to match my query.
Task: Extract content between <div class="test"> and the first closing </div> tag.
Original source:
<div class="test">optional text<br/>
content<br/>
<br/>
c...
i need some code for the next step..this my first step:
<script>
$("#mod").change(function() {
var barcode;
barCode=$("#mod").val();
var data=barCode.split(" ");
$("#mod").val(data[0]);
$("#seri").val(data[1]);
var str=data[0];
var matches=str.matches(/EE|[EJU]).*(D)/i);
...
Hi,
I need to come up with a regular expression to validate hostname against
RFC-1123 and RFC-952.
Right now I'm using this:
^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|\b-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|\b-){0,61}[0-9A-Za-z])?)*\.?$/
but this does not do the trick since it does not catch a. as invalid hostname...
I am trying to make simple regex that will check if a line is blank or not.
Case;
" some" // not blank
" " //blank
"" // blank
...
I am looking for a regex to replace a given string in a html page but only if the string is not a part of the tag itself or appearing as text inside a link or a heading.
Examples:
Looking for 'replace_me'
<p>You can replace_me just fine</p> OK
<a href='replace_me'>replace_me</a>
no match
<h3>replace_me</h3>
no match
<a href='/test...
I have some large text files which im going to preform consecutive matching on (just capturing, not replacing). Im thinking its not such a good idea to keep the whole file in memory, but rather use a Reader.
What i know about the input is that if there's a match, its not going to span more than 5 lines. So my idea was to have some sort ...
In a nutshell, I want to have different faces for some types of file in dired mode. I don't think it matters, but I am using Aquamacs.
The example I will use here is .tex files. If I can do it for .tex, then I can just apply the same structure to do create other faces for other types of files.
From what I understand, I have to create a...
$a ="SCNSC: [email protected]";
$b ="alerts: nek";
$c ="daily-report: tasd,dfgd,fgdfg,dfgdf,[email protected]";
print "matched" if ($a =~ /\w+:\s*\w+@\w+\.\w+/ );
print "matched" if ($b =~ /\w+:\s*\w+[,\w+]{0,}/ );
print "matched...
Hi all,
I am doing some self learning about Patern Matching in Javascript.
I got a simple input text field in a HTML web page,
and I have done some Javascript to capture the string and check if there
are any strange characters other than numbers and characters in the string.
But I am not sure if it is correct.
Only numbers, characters o...