Regex for timestamps in php
I'm trying to take timestamps in this format: 2009-11-16T14:05:22-08:00 and make turn them into something like 2009-11-16 How do I remove everything after the "T"? ...
I'm trying to take timestamps in this format: 2009-11-16T14:05:22-08:00 and make turn them into something like 2009-11-16 How do I remove everything after the "T"? ...
I have a string like: Today, 3:30pm - Group Meeting to discuss "big idea" How do you construct a regex such that after parsing it would return: Today 3:30pm Group Meeting to discuss big idea I would like it to remove all non-alphanumeric characters except for those that appear in a 12 or 24 hour time stamp. All help is appreciated. T...
Hi I am not sure what I am doing wrong. I am trying to use the asp.net regex.replace but it keeps replacing the wrong item. I have 2 replaces. The first one does what I want it to it replaces what I want. The next replace that is almost a mirror image does not replace what I want. So this is my sample code <%@ Page Title="Tour" Lang...
Through the code i got the output content as XML. I have pair or multiple of html tags as follows: December 10 Welcome to this space Hai, Today is Tuesday This a xml tag I want a regular expression as below requirement: As above mentioned i want only one EMPTY pair Tag as . I do not want the repeate...
Through the code i got the output content as XML. I have pair or multiple of XML tags as follows: <p>December10</p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> Welcome to this space </p> <p> </p> <p> </p> <p>Hai, Today is Tuesday</p> <p> </p> <p> </p> <p> </p> <p>This a xml tag</p> I want a regular expression as below requirement...
Hi, I'm building a pseudo-variable parser in PHP to allow clean and simple syntax in views, and have implemented an engine for if-statements. Now I want to be able to use nested if-statements and the simplest, most elegant solution I thought of was to use identation as the marker for a block. So this is basicly the layout I'm looking f...
Hello, I am using a regular expression to find links in a generic string and highlight that text(underline, a href, anything). Here's what I have so far: var linkRegEx:RegExp = new RegExp("(https?://)?(www\\.)?([a-zA-Z0-9_%]*)\\b\\.[a-z]{2,4}(\\.[a-z]{2})?((/[a-zA-Z0-9_%]*)+)?(\\.[a-z]*)?(:\\d{1,5})?","g"); var link:String = 'generic ...
If I have the following in my flex file, what does it do? [\\[\\];] { return yytext[0]; } ...
Does anybody know if Python (any version) used NFAs (Non-Deterministic Finite Automata) to evaluate regular expressions or does it use some other mechanism? Please provide links/reference if available. ...
In my home directory I have a folder drupal-6.14 that contains the Drupal platform. From this directory I use the following command: find drupal-6.14 -type f -iname '*' | grep -P 'drupal-6.14/(?!sites(?!/all|/default)).*' | xargs tar -czf drupal-6.14.tar.gz What this command does is gzips the folder drupal-6.14, excluding all subfold...
Regular expressions are great for text editing. But sometimes they aren't quite enough. For example, say I have a text with 1000 sentences, with the first character in lowercase: my name is Foo. hello, how are you? i really like this forum. ... etc. And I want to convert them so that the first letter is capitalized. This IS possible wi...
I'm trying to find all labels with an id and text, but my regex doesn't seem to work: With the following regex: <asp:[a-z]+.*? ID="(?<id>.*?)".*? Text="(?<text>.*?)".*?/> and the following sample text: <asp:Label ID="SomeID" Text="SomeText" /> <asp:Label Text="SomeText" /> <asp:Label ID="SomeID" /> <asp:Label ID="SomeOtherID" Tex...
I'm using this regex to find <script> tags: <script (.|\n)*>(.|\n)*?</script> The problem is, it matches the ENTIRE string below, not just each tag separately: <script src="crap2.js"></script><script src="crap2.js"></script> ...
I'm trying to do some batch replacement for/with a fairly complex pattern So far I find the pattern as: find '(' -name '*.php' -o -name '*.html' ')' -exec grep -i -n 'hello' {} + The string I want to replace is currently as follow: <img src="/some/path/to/somewhere/hello" /> where the path for the image varies but always contain t...
I have a regex expression that I'm using to find all the words in a given block of content, case insensitive, that are contained in a glossary stored in a database. It appears too be a little too inclusive. Here's my pattern: /($word)/i The problem is, if the word "Foo" is in the glossary then the first three letters of the word "Food...
String text = "[! hello ¡world ¡] otra cosa ¡]"; String pt = "\\[!(.*)¡\\]"; Matcher mc = Pattern.compile(pt).matcher(text); while( mc.find() ){ System.out.println(mc.group(1)); } This code prints hello ¡world ¡] otra cosa. What would be a pattern that matches only hello ¡world? What I don't find is a way to negate a literal stri...
I have a bunch of files that need to be parsed, and they all have one of two date patterns in the file name (we're upgrading our system, and we need to have the file parser be able to recognize both date formats, new and old). The filenames look like either <fileroot>_yyyyMMdd.log or <fileroot>_MMddyy.log, and I need to be able to parse...
i want to find name and email from following formats (also if you know any other format that been getting use in mail application for sending emails, please tell in comment :)) how can i know name and email for following format strings (its one string and can be in any following format): - [email protected] - james [email protected]...
Hi everyone, Is there a regex for checking if the xml is well formed ? Thanks Edit: If not regex, then is there a good parsing method that i can use in c# that doesnt throw exception. I tried using xmlReader but it didnt work for me. ...
I've got a copy-clipboard icon on a website, which, when clicked, invokes the following JavaScript (among other): var hasInnerText = (document.getElementsByTagName("body")[0].innerText != undefined) ? true : false; var elem = document.getElementById(codeID); var content; // strip out all html tags and just get the text if (!hasInnerTe...