Hi, all!
Q1.I want to match "&JOY" in a user input string, for example, "bla bla &JOY bla bla &JOY blabla"
How can I write the regex expression for this, and are there any C regex functions could return all the positions where the matches happen?
Q2.If I want to substitute &JOY with another string is there a convenient C function to do t...
Hello, I have the following code to first remove html tags and then highlight the search term within the resulting text:
protected void ListView1_ItemDataBound(object sender, ListViewItemEventArgs e)
{
try
{
// get search value query string
string searchText = Request.QueryString["search"].Trim();
string ...
I would like to check whether some string match any of a given set of regexes. How can I do that?
...
Is it possible ( or why not possible ) to convert input string to a string that match regex in least Levenshtein distance ?
i.e. if 1234 is string and ^([0-9]{6})$ is regex, i need output something like 123412 ( output string matches the regex and is 2 distance from original string, there may be other string but first result will do )
...
I would like to match paths like /this/is/my/dir/name/anything but not /this/is/my/dir/name/anything/anything2. In other words, I want to match all files and sub directories on the first level under `/this/is/my/dir/name/, but not anything on lower levels.
...
Perl's quotemeta operator typically works on the SEARCH side of s///, but in generating code to be compiled with eval, how should I protect the REPLACEMENT that should be used literally but may contain bits such as $1?
With code of the form
my $replace = quotemeta $literal_replacement;
my $code = eval <<EOCode;
sub { s/.../$replace/...
I have a large set of XPaths for selecting content in webpages and I want users to be able to use them in the browser (including IE).
What do you recommend?
Try and interpret the XPaths with JavaScript?
Or perhaps convert to regex?
Some existing JavaScript XPath work:
http://js-xpath.sourceforge.net/xpath-example.html
http://goog-aja...
To add full text search to my App Engine app I've added the following field to my model:
private List<String> fullText;
To test the search, I took the following text:
Oxandrolone is a synthetic anabolic steroid derived from dihydrotestosterone by substituting 2nd carbon atom for oxygen (O). It is widely known for its exceptionally s...
I found this snippet online and the purpose is to commify any number including numbers with decimals ... 99999999 => 99,999,999. I can see that it uses regex but I am confused by "$1.reverse, $2"
def commify(n)
n.to_s =~ /([^\.]*)(\..*)?/
int, dec = $1.reverse, $2 ? $2 : ""
while int.gsub!(/(,|\.|^)(\d{3})(\d)/, '\1\2,\3')
end
...
I've tried, with M-x align-regexp:
<-|=
(<-|=)
\(<-|=\)
\\(<-|=\\)
And the ones with <- and = reversed. But none work?
Example code as follows:
(flags, params, errs) <- parseArgs <$> getArgs
let options = foldr id [] flags -- Apply functions to list
...
I'm trying to validate wether a Model.category equals any existing Category name
unless Category.exists?(:name => self.category.downcase)
I had to put downcase in this to ensure all of them were downcased so they could match up as strings. But its a big server hit to update the attribute before_save, and I was thinking of just matchin...
This is a generalization of a specific problem I am trying to solve.
Given a string of uniquely identifiable elements separated by a single space:
0 1 2 3 4
Without modifying the string, what regular expression will match this expression when any of the numbers are optional except one and the numbers are in order?
Examples of other ...
I have this code
Dim parts As New List(Of String)(Regex.Split(RichTextBox2.Text, "~\d"))
That splits lines in this format into parts:
~1Hello~2~3Bye~4~5Morning~6
So if I do MsgBox(parts(5)), it will show me "Morning".
I want to do the exact same thing, but now my line is arranged like this:
Hello, Bye, Morning,
...
I want to replace comma when its inside parentheses only.
For Example
Progamming languages (Java, C#, Perl)
TO
Progamming languages (Java or C# or Perl)
but it should not repace comma in following string
Progamming languages Java, C#, Perl
CODE
It will replace correctly but its not matching up.
String test = "Progamm...
$.validator.addMethod('AZ09_', function (value) {
return /^[a-zA-Z0-9.-_]+$/.test(value);
}, 'Only letters, numbers, and _-. are allowed');
When I use somehting like test-123 it still triggers as if the hyphen is invalid. I tried \- and --
...
I need to replace all minutes with hours in a file.
Assume a raw file like this:
120m
90m
Should change to:
2h
1.5h
...
i got a
$str ="sometxt<br>another<br>moretext<br>evenmoretext<br>";
i'm trying to output the string in one array per line.
kinda like this..
[0] => Array
(['stuff'] => sometext
)
[1] => Array
(['stuff'] => another
)
[2] => Array
(['stuff'] => moretext
)
[3] => Array
(['stuff']...
I need a regex that extract text inside a delimiter but I'm
having problem extracting the value inside the delimiter [DATA n] and [END DATA]
Here's my regex
(?<=\[DATA\s+\d+\]).*(?=\[END DATA\])
Here's example data I want to match
Some text here
[DATA 1]
data one
some more data
[END DATA]
[DATA 2]
data two
more data
data
[END DAT...
Hey, I am working on a very basic parser. I am almost certain that my regex is correct, but values do not seem to be being stored in my $1 and $2. Am I doing something wrong? I am just looking for tips to alter my code. Thanks for any advice! Also, I am new to Perl, so if I did something wrong, I am looking to get off on the right foot a...
Hey guys,
I have the following bit of text (or some similar variation of it):
Recurring Event
First start: 2010-09-16 17:00:00 EDT
Duration: 4800
Event Status: confirmed
I need to select the timestamp of the "First Start" field and the duration.
Normally I would split the string at the colons, but since the tim...