I have a little problem on RegEx pattern in c#. Here's the rule below:
input: 1234567
expected output: 123/1234567
Rules:
Get the first three digit in the input. //123
Add /
Append the the original input. //123/1234567
The expected output should looks like this: 123/1234567
here's my regex pattern:
regex rx = new regex(@"((\w{1,...
In a program I'm making in python and I want all words formatted like __word__ to stand out. How could I search for words like these using a regex?
...
I am having some issues with matching text to extract data from an HTML page. Here is what I have so far, but plainText stays empty:
private void Scrape()
{
// create variables
string html;
string plainText;
// download page source
// sample URL: http://freekeywords.wordtracker.com/?seed=test&adult_filter=remove_offensive...
Hi,
Does javascript regular expressions support backreferences inside character class?
I want to do something like this:
htmlString.replace(/attribute_name=(['"])[^\1]*\1/,'')
But that does not work. This does:
htmlString.replace(/attribute_name=(['"])[^'"]*\1/,'')
Unfortunatelly my attribute_name can contain apostrophes or quote...
Hello All
Request your valueable time in helping me to find substring values using Regular Expressions..
This is my input
"ADMIN:YESEXT:NOBAT:NOBOM:NO"
I should be able to extract the following things to output
ADMIN:YES
EXT:NO
BAT:NO
BOM:NO
I used the following regex to get just the ADMIN: string
^\s?(?:ADMIN:)
How should i mod...
I need to write a regular expression in order to be able to match the following patterns:
IF:en0
IF:en0:10.94.80.78
IF:en11
IF:en11:10.94.80.78
The regular expression i wrote in PL SQL was
IF REGEXP_LIKE(input_str,
'^IF:en([0-9])([:]?)((25[0-5]|2[0-4][0-9]|[01]?[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]{1,2})$') then
DB...
Hi,
is there any good way to remove everything from a string except the content inside a <span> tag?
Example:
$myString = "mso:dkdlfkdl */1134*/** <span>Hello</span>";
i want:
$myNewString = '<span>Hello</span>';
??
...
Hello people,
so, i have some kind of intern urls: for example "/img/pic/Image1.jpg" or "/pic/Image1.jpg" or just "Image1.jpg", and i need to match this "Image1.jpg" in other words i want to match last character sequence after / or if there are no / than just character sequence. Thank you in advance!
...
Hi,
I would like to replace strings like 'HDMWhoSomeThing' to 'HDM Who Some Thing' with regex.
So I would like to extract words which starts with an upper-case letter or consist of upper-case letters only. Notice that in the string 'HDMWho' the last upper-case letter is in the fact the first letter of the word Who - and should not be i...
I am trying to parse the digits to store in a variable from a string in VB.NET (would like to also include the decimal point).
Here is an example string: Refund issued for $27.74
...
I'm trying to use a regular expression to find all substrings that start with an equals sign (=) and ends with a semicolon (;) with any number of characters in between. It should be something like this =*;
For some reason, the equals is not registering. Is there some sort of escape character that will make the regex notice my equals sig...
Trying to get a regex that I can get a style attribute value from the example below should explain my issue.
source: font-size:11pt;font-color:red;text-align:left;
want to say give me ..
font-size and returns 11pt
font-colour and returns red
text-align and returns left
Can someone point me in the right direction
Thanks
Lee
...
It seems that this is a huge source of confusion for beginners writing regular expressions, can cause hidden performance problems, and it would seem that a typical use case would be non-greedy.
Is this just for legacy reasons (it was how it was first done, and every implementation copies that), or is there a reason for it?
...
Replacing the urls in a block of plain text is done by looking for url regular expressions. I am using string.gsub(regex, "\1") to achieve the same.
I would like to know how to proceed if the shortened url (using api's of any url shortening service) is to be used as the replacement and not the original url.
I am using Ruby.
...
I'm trying to write some regex that will parse information from alerts generated by Hyperic HQ. The alerts come in as emails with a subject line like:
"[HQ] !!! - Alert: My Demo Website Alert Resource: demo.myserver.net Apache Web Server State: fixed"
To cut a very long story short, I need to be able to consistently grab the "Apache W...
$subject = "SPRINT-1.csv";
$pattern = '/^[a-zA-Z]\-[0-9]\.(csv)+$/';
if(preg_match($pattern, $subject)) {
echo "Match";
} else {
echo "NOPE";
}
or
$subject = "SPRINT-1.csv";
$pattern = '/^\w\-\.(csv)+$/';
if(preg_match($pattern, $subject)) {
echo "Match";
} else {
echo "NOPE";
}
...
I want to prevent the entry of two characters together but I want the user to be able to enter one or the other as well as use the enter key. I would like to use a white list instead of black listing characters. The regular expression also needs to support a min and max length. I'm doing client side validation using the asp:regularexpre...
hi i am trying to get the extension of the file called in a url (eg"/wp-includes/js/jquery/jquery.js?ver=1.3.2 HTTP/1.1") and get the query perimeters passed to the file too what would be the best way to the extension?
...
$tags = preg_replace('/\s\s+/',' ', $tags);
that will remove more than just one space ?
i need to remove anything more than double space.
...
I need to match all valid URLs except:
http://www.w3.org
http://w3.org/foo
http://www.tempuri.org/foo
Generally, all URLs except certain domains.
Here is what I have so far:
https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?
will match URLs that are close enough to my needs (but in no way all valid URLs!) (thanks, h...