So I have some PHP code that looks like:
$message = 'Here is the result: %s';
I just used %s as an example. It's basically a placeholder for whatever will go there. Then I pass the string to a function and I want that function to replace the %s with the value.
What do I need to do to achieve this? Do I need to do some regex, and use ...
I am parsing some HTML source. Is there a regex script to find out whether alt tags in a html document are empty?
I want to see if the alt tags are empty or not.
Is regex suitable for this or should I use string manipulation in C#?
...
Need regex to parse long words with 20+ symbols length that can potentially break design. Planning to use for separating word parts.
...
Hi all,
I need help on regex or preg_match because I am not that experienced yet with regards to those so here is my problem.
I need to get the value "get me" but I think my function has an error.
The number of html tags are dynamic. It can contain many nested html tag like a bold tag. Also, the "get me" value is dynamic.
<?php
functi...
I am writing a script in Perl which searches for a motif(substring) in protein sequence(string). The motif sequence to be searched (or substring) is hhhDDDssEExD, where:
h is any hydrophobic amino acid
s is any small amino acid
x is any amino acid
h,s,x can have more than one value separately
Can more than one value be assigned to o...
I try to test regular expression $ anchor using .net framework, the result is unexpected. The $ anchor only return the last one. I note the multiline switch is important, and I already used it here. Can anyone tell the reason. Following is my test code
Thanks
Fred
string sourceText =
@"ab<br />
ab<br />
ab";
//var m =...
Have a text file that denotes remarks with a single '. Some lines have two quotes but need to get everything from the first instance of a ' and the line feed.
I AL01 ' A-LINE '091398 GDK 33394178
402922 0831850 ' '091398 GDK 33394179
I AL02 ...
Hello,
Say there are six strings
"abcd bbb ccc"
"abce bbb ccc"
"abcf bbb ccc"
"aaa abcd ccc"
"aaa abce ccc"
"aaa abcf ccc"
User enters expression "<abc[!e]"
This expression gets translated into following regex "^abc[^e]"
Translated regex would successfully match strings 1 and 3
If I wanted to match strings 4 and 6 the expression ...
Hi
I am having some trouble with this regex:
<img(.+)src="_image/([0-9]*)/(.+)/>
Global and case insensitive flags is on.
The problem is that it also grabs Image n (see string below), but I want it only to match the image tags in the string.
<p>Image 1:<img width="199" src="_image/12/label" alt=""/> Image 2: <img width="199" src="...
I have as input blocks of text with commands and arguments, one per line, such as
XYZ ARG1,ARG2,ARG3,...,ARGN
And I want to verify that the arguments to XYZ are well formed for that particular command and execute the correct block of code if they are. There are something like ~100 commands, some of which have variable numbers of argum...
I have a TextBox in a webpage that i'm using javascript to parse and modify to format for HTML. 90% of it works really well, the last main thing i'm trying to be able to support is copying and pasting from a word document. I got it mostly completely, i just am kinda stuck on finding list and wrapping them in a UL tag..
So, using regu...
I'm nearly done with a trackback system for my website, but have one last niggling regular expression I just can't get right.
What I'm after is an excerpt of the referring page, where I'm defining the most relevant excerpt as:
The first paragraph (marked by <p></p> tags) that follows either an <h1></h1>, <h2></h2> or <h3></h3> in the H...
I am iterating through a file and on each line I am looking for a regex. If the regex is found I just want to print "it's found" and then the index location of where it was found in that line.
Example:
looking for: 'HDWFLSFKD' need index between two Ds
line: MLTSHQKKF*HDWFLSFKD*SNNYNSKQNHSIKDIFNRFNHYIYNDLGIRTIA
output: 'its found' in...
what is the regular expression for a url without 'http://www.'? i'd like to validate whether it is uri or not when the user enters the uri name
...
How do I write a regular expression that includes all keyboard characters except '~' and ','?
...
I'm doing maintenance of a few branches of middle-size C++ project (~15k files for each branch). Very often I have to search all project files for given string or regex. Currently I'm using Total Commander which has all features I want (case-sensitive, regexes, filename masks) but this tool scans all files every time, so it takes a bit t...
I can't seem to set regex correctly for the directive.
The syntax is:
<LocationMatch regex> ... </LocationMatch>
I've tried many of the following to no avail:
<LocationMatch "^/(admin-media|connect|css|downloads|images|images-web|js)/.+$">
<LocationMatch "^/(admin-media|connect|css|downloads|images|images-web|js)/.+">
<LocationMatc...
What is the regex to strip the MY-CORP\ part of na inputed string like MY-CORP\My.Name with the java String.replaceAll method so I can get only the My.Name part?
I tried
public static String stripDomain(String userWithDomain) {
return userWithDomain.replaceAll("^.*\\", "");
}
but i got Unexpected internal error near index 4 ^.*
...
I'm looking for a RegEx to return either the first [n] words in a paragraph or, if the paragraph contains less than [n] words, the complete paragraph is returned.
For example, assuming I need, at most, the first 7 words:
<p>one two <tag>three</tag> four five, six seven eight nine ten.</p><p>ignore</p>
I'd get:
one two <tag>three</ta...
I'm trying to do a replace of all instances of strings like
PageLocalize("Texts", "R73")
with something like
Texts.R73.Localise()
I have a regex for matching these strings:
PageLocalize\("([A-Za-z]+)", "([A-Za-z0-9]{0,6})"\)
And a replacement string:
$1.$2.Localise()
but The Regex Coach says my replacement result is
$1.$2.Lo...