How do I remove a character from an element in a list?
Example:
mylist = ['12:01', '12:02']
I want to remove the colon from the time stamps in a file, so I can more easily convert them to a 24hour time. Right now I am trying to loop over the elements in the list and search for the one's containing a colon and doing a substitute.
fo...
Hi all, somewhat open ended question here as I am mostly looking for opinions. I am grabbing some data from craigslist for apt ads in my area since I am looking to move. My goal is to be able to compare items to see when something is a duplicate so that I don't spend all day looking at the same 3 ads. The problem is that they change t...
Hello,
I am wanting to take a string of say the following:
Guiness Harp "Holy Moses"
So that in C# or VB get a match set of:
Guiness
Harp
Holy Moses
Essentially it splits on the spaces unless there are quotes around the spaces, then those words between quotes are considered a single phrase.
Thanks,
Kevin
...
I have a text file that has sets of text I need to extract that looks something like as follows:
ITEM A blah blah blah ITEM B bloo bloo bloo ITEM A blee blee blee ITEM B
Here is the working code I have so far:
finda = r'(Item\sA)'
findb = r'(Item\sB)'
match_a = re.finditer(finda, usefile, 2) # the "2" is a flag to say ignore case
ma...
Not sure if this is possible across all modern browsers, but is there any way, using javascript/jquery to remove all html tags, css formatting, word doc format codes, ect. from a string of text as it is being pasted into an input area of a page (in my case an element set as "contenteditable), so it always goes in as just pure plaintext? ...
only numbers must be in that textbox
that entries have to be in 100 between 500
TextBox Needed to include 3 Decimal Places
i dont want any mistakes while values inserting to database.
Do i need to use jQuery or ASP.NET Validation Controls ?
if jQuery is useful one then which plugin will i use else for asp.net RegEx Validator which V...
I have a string that needs to be validated.
The first two characters must be made up A-G, or Z, but cannot be the following combination: GB or ZZ.
How do I express that in a regular expression?
...
What I'm interested in is a regular expression that will accept HTML input and remove all attributes inside the tag while leaving the tag intact. For example I want this...
<p class="test" id="TestParagraph">This is some test text right here.</p>
To become this...
<p>This is some test text right here.</p>
Any help would be much app...
Hello,
I have a specialized string dictionary of (string, string) (_RulesAndTheirDescriptions) that contains the name (key) and description (value) of methods in a given class. I currently do the following query to search for a match on the key or value and then bind that to a grid. Works great!
Dim Results = From v In _RulesAndThe...
What will be the best way using javascript regular expression to get numbers out of text..
e.g.... I have "$4,320 text/followme" and I want to get 4320 out of this. However I want to avoid numbers after first occourance of an alphabet or any non alphabet other than a comma ','
so that if i have $4,320 t234ext/followme it will still ret...
Hi,
I have the following JSON object which has a date field in the following format:
{
"AlertDate": "\/Date(1277334000000+0100)\/",
"Progress": 1,
"ReviewPeriod": 12
}
I want to write a regular expression or a function to convert it to a javascript object so that it is in the form:
{
"AlertDate": "AlertDate":new Dat...
I've created a simple template 'engine' in PHP to substitute PHP-generated data into the HTML page. Here's how it works:
In my main template file, I have variables like so:
<title><!-- %{title}% --></title>
I then assign data into those variables for the main page load
$assign = array (
'title' => 'my website - '
);
I then have ...
<html><body><script>
var matches = /(\w+)(\s*(\w+))?/.exec("aaa");
alert(matches.length);
alert(typeof(matches[3]));
</script></body><html>
I'm really new to regular expressions, so this may be a very easy question.
The regular expression above /(\w+)(\s*(\w+))?/ matches patterns like "aaa", "123", "my_var" or "aaa bbb", "123 456", "m...
Hi,
I would like to do a global replace on a string like this:
var d = "{\"AlertDate\": \"\/Date(1277334000000+0100)\/\",\"Progress\": 1,\"ReviewPeriod\": 12}";
and replace all the \/Date(1234656000000+0100)\/ fields with the following:
"{\"AlertDate\": \"new Date(1234656000000+0100)",\"Progress\": 1,\"ReviewPeriod\": 12}";
How co...
Hello,
I would like to replace the link location (of anchor tag) of a page as follows.
Sample Input:
text text text <a href='http://test1.com/'> click </a> text text
other text <a class='links' href="gallery.html" title='Look at the gallery'> Gallery</a>
more text
Sample Output
text text text <a href='http://example.com/p.php?q=...
i use this line to search for a name in text with url's.
$name = "xxx";
$text = "my name is xxx en my website is http://xxx.something.com";
$text = preg_replace("/\b(".preg_quote($name, "/").")\b/i", $url, $text);
how can i change this regex to ignore urls in the text
...
I want to match following pattern:
key="value" key="value" key="value" key="value" ...
where key and value are [a-z0-9]+, both should be grouped (2 groups, the " - chars can be matched or skipped)
input that should not be matched:
key="value"key="value" (no space between pairs)
For now I got this(not .NET syntax):
([a-z0-9]+)...
I have very simple python script to match some special characters like -,+,-,.
But Im not getting expected result while using regex \ to match a single '\' char.
import re
pat = r'[-+*\\]'
text = 'fdkjdfk\sdsdd'
if re.search(pat,text):
print re.search(pat,text).group()
else:
print "not found"
On running above code , it prints 'n...
I have a string which I'd like to remove the end of line characters from the very end of the string only using Java
"foo\r\nbar\r\nhello\r\nworld\r\n"
which I'd like to become
"foo\r\nbar\r\nhello\r\nworld"
(This question is similar to, but not the same as question 593671)
...
Hi guys,
simple example in Notepad++ using RegEx replace
search for: anything
replace with (wanted): \test
guess for regex replace string: \test
results in: tabest, so the \t is interpreted as a tab
guess for regex replace string: \\test
results in: \ tabest, so the first \ is interpreted as a \, the \t is interpreted as a tab
guess f...