I have a string like this:
<span style="font-weight: bold;">Foo</span>
I want to use PHP to make it
<strong>Foo</strong>
…without affecting other spans.
How can I do this?
...
MetaMap files have following lines:
mappings([map(-1000,[ev(-1000,'C0018017','Objective','Goals',[objective],[inpr],[[[1,1],[1,1],0]],yes,no)])]).
The format is explained as
mappings(
[map(negated overall score for this mapping,
[ev(negated candidate score,'UMLS concept ID','UMLS concept','preferred name for conce...
Hi,
I've tried to strip html tags using regex replace with pattern "<[^>]*>" from word generated html that looks like this:
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://...
I am new to programming PHP and am trying to validate a field in a form.
The field if for a RAL color code and so would look something like : RAL 1001.
so the letters RAL and then 4 numbers.
Can someone help me set them into a regular expression to validate them.
i have tried this with no success:
$string_exp = "/^[RAL][0-9 .-]+$/i";
...
I need to use regular expressions in C and was looking for a clear tutorial on its use and how to capture substrings. (I'm using the regex.h library on linux)
I have used regular expressions before in other languages so know how to construct the actual expressions, I am looking for a tutorial on it's implementation in C.
Thanks.
...
I am new to PHP and regular expression. I was going thorugh some online examples and came with this example:
<?php
echo preg_replace_callback('~-([a-z])~', function ($match) {
return strtoupper($match[1]);
}, 'hello-world');
// outputs helloWorld
?>
in php.net but to my surprise it does not work and keep getting error:
PHP Parse ...
I have a string "one two 9three 52eight four", so I only want to get "one two four", because "three" starts with "9" and "eight" starts with "52".
I tried:
"(?!\d)\w+"
but it's still taking the "three" and "eight". I don't want it.
...
I am trying a substring to find from the beginning of the string to the point that has the escape sequence "\r\n\r\n" my regex is Regex completeCall = new Regex(@"^.+?\r\n\r\n", RegexOptions.Compiled); it works great as long as you only have strings like 123\r\n\r\n however once you have the pattern 123\r\n 456\r\n\r\n the pattern no lon...
Hi All guys!
i'm pretty new on regex, i have learned something by the way, but is still pour knowledge!
so i want ask you for clarification on how it work!
assuming i have the following strings, as you can see they can be formatted little different way one from another but they are very similar!
DTSTART;TZID="America/Chicago":2003081...
Let's say we make a request to a URL and get back the raw response, like this:
HTTP/1.1 200 OK
Date: Wed, 28 Apr 2010 14:39:13 GMT
Expires: -1
Cache-Control: private, max-age=0
Content-Type: text/html; charset=ISO-8859-1
Set-Cookie: PREF=ID=e2bca72563dfffcc:TM=1272465553:LM=1272465553:S=ZN2zv8oxlFPT1BJG; expires=Fri, 27-Apr...
I there
I'm working on a C# app, and I get a string with a date or part of a date and i need to take day, month and year for that string
ex:
string example='31-12-2010'
string day = Regex.Match(example, "REGULAR EXPRESSION FOR DAY").ToString();
string month = Regex.Match(example, "REGULAR EXPRESSION FOR MONTH").ToString()
string year =...
I want to combine two relative paths in C#.
For example:
string path1 = "/System/Configuration/Panels/Alpha";
string path2 = "Panels/Alpha/Data";
I want to return
string result = "/System/Configuration/Panels/Alpha/Data";
I can implement this by splitting the second array and compare it in a for loop but I was wondering if there i...
I'm trying to match the point between 2nd and 3rd paragraphs to insert some content. Paragraphs are delimited either by <p> or 2 newlines, mixed. Here's an example:
text text text text
text text text text
<p>
text text text text
text text text text
</p>
<--------------------------- want to insert text here
<p>
te...
Hello everyone!
So here is my situation, and the solution that I've come up with to solve the problem. I have created an application that includes TinyMCE to allow users to create HTML content for publishing. The user can include images in their markup, and drag/resize those images affecting the final Width/Height attributes in the IMG ...
I'm working on 2 cases:
assume I have those var:
a = "hello"
b = "hello-SP"
c = "not_hello"
Any partial matches
I want to accept any string that has the variable a inside, so b and c would match.
Patterned match
I want to match a string that has a inside, followed by '-', so b would match, c does not.
I am having problem, because...
Many URL rewriting utilities allow Regex matching. I need some URLs to be matched against a couple of main querystring parmeter values no matter what order they appear in. For example let's consider an URL having two key parameters ID= and Lang= in no specific order, and maybe some other non-key params are interspersed.
An Example URL t...
I have a partially converted XML document in soup coming from HTML. After some replacement and editing in the soup, the body is essentially -
<Text...></Text> # This replaces <a href..> tags but automatically creates the </Text>
<p class=norm ...</p>
<p class=norm ...</p>
<Text...></Text>
<p class=norm ...</p> and so forth.
I nee...
I need to be able to split an input String by commas, semi-colons or white-space (or a mix of the three). I would also like to treat multiple consecutive delimiters in the input as a single delimiter. Here's what I have so far:
String regex = "[,;\\s]+";
return input.split(regex);
This works, except for when the input string start...
I'm using the following command to auto replace some code (adding a new code segment after an existing segment)
%s/my_pattern/\0, \r some_other_text_i_want_to_insert/
The problem is that with the \r, some_other_text_i_want_to_insert gets inserted right after the new line:
mycode(
some_random_text my_pattern
)
would become
mycode...
/^\d{1,2}[:][0-5][0-9]$/
is what I have. this limits minutes to 00-59. It does not, however, limit hours to between 0 and 12. For similarity and uniformity I would like to do this with RegEx alone if possible.
Further-more I would like the first digit to be optional. i.e. 09:30 accepted as well as 9:30. I played around with ranges, bu...