JavaScript mins and seconds into seconds
I have a string being grabbed from a page in the format "4m 26s", how can I strip this into just seconds? Many thanks, ...
I have a string being grabbed from a page in the format "4m 26s", how can I strip this into just seconds? Many thanks, ...
Let's say I have a string contaning HTML markup with many img tags that look like this: <img src="data/images/original/3.png" alt="" /> I need a regular expression that would change all images to have paths like this: <img src="/utils/locate-image?path=data%2Fmedia%2Fimages%2Foriginal%2F3.png" alt="" /> I'm not very good with regul...
$.trim() uses the following RegExp to trim a string: /^(\s|\u00A0)+|(\s|\u00A0)+$/g As it turns out, this can be pretty ugly, Example: var mystr = ' some test -- more text new test xxx'; mystr = mystr.replace(/^(\s|\u00A0)+|(\s|\u00A0)+$/g, ""); This code hangs Firefox ...
hi,all I want to apply validation for Special characters like (,/'#~@[]}{+_)(*&^%$£"!\|<>) using the jsf validator. i have implemented the validator for number but now i want to make validator for Special characters. value.toString().trim().matches(); What will be the regular expression inside the matches() method in java class? i w...
I am trying to parse input string using regular expression. I am getting problem when trying to capture a repeating group. I always seem to be matching last instance of the group. I have tried using Reluctant (non greedy) quantifiers, but I seems to be missing some thing. Can someone help? Regular expression tried: (OS)\\s((\\w{3})(([...
Hi All, I am using ^[\w-\.\+]+@([\w-]+\.)+[\w-]{2,4}$ to validate email address, when I use it from .aspx.cs it works fine to validate IDN email but when I use it from aspx page directly it doesn't work. return Regex.IsMatch( email, @"^[\w-\.\+]+@([\w-]+\.)+[\w-]{2,4}$", RegexOptions.Sin...
Hi, I am trying to write a pattern in Java to match against Java import declarations. Example: import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.InputFormat; import org.apache.hadoop.mapreduce.Mapper; import org.apache.hadoop.mapreduce.Reducer; // import org.apache.hadoop.map...
I am trying to parse an input string using a regular expression. I am getting a problem when trying to capture a repeating group. I always seem to be matching last instance of the group. I have tried using Reluctant (non greedy) quantifiers, but I seems to be missing something. Can someone help? Regular expression tried: (OS)\\s((\\w{...
I tried the following at http://gskinner.com/RegExr, there it worked perfectly. Now I want to get the /(?<=>\r\s{23})(.*)/gi pattern realized in PHP. The > character don't perform well, also not with backslashes... I want to get the 2011 Oct 3, Mon, Unity Day and in the mid of every <FONT></FONT>. Searc...
I'm trying add a bold/strong tag the line headings of the follow string/text block: Length Determination: the dimensions above show what center-to-center length can be achieved by the connecting linkage length shown for male spherical rod ends. Material: aluminum. Specials: specials are available at any volume. ...
In Perl I am trying to read a log file and will print only the lines that have a timestamp between two specific times. The time format is hh:mm:ss and this is always the third value on each log. For example, I would be searching for lines that would fall between 12:52:33 to 12:59:33 I am new to Perl and have no idea which route to tak...
let test = 'a href="http://www.google.com">www.google.com</a;' in vimscript, how can i get http://www.google.com out of this using a regexp, and store it in another variable? i can't seem to find any documentation about this. thanks in advance! ...
I would like to input a string and return a regular expression that can be used to describe the string's structure. The regex will be used to find more strings of the same structure as the first. This is intentionally ambiguous because I will certainly miss a case that someone in the SO community will catch. Please post any and all po...
I am very new to RegEx -- so can someone please help me figure out what exactly is going wrong here? I have this code: string regPattern = "*[~#%&*{}/<>?|\"-]+*"; string replacement = ""; Regex regExPattern = new Regex(regPattern); Yet, when my app hits the regExPattern line, i get an ArgumentException -- Quantif...
Hi all. Have a perl script that needs to process all files of a certain type from a given directory. The files should be those that end in .jup, and SHOULDN'T contain the word 'TEMP_' in the filename. I.E. It should allow corrected.jup, but not TEMP_corrected.jup. Have tried a look-ahead, but obviously have the pattern incorrect: /(...
Using linq (.net 3.5 +) and predicate builder, I did it like so: var startsWith3Chars = new System.Text.RegularExpressions.Regex(@"^[a-zA-Z]{3}\-", System.Text.RegularExpressions.RegexOptions.Compiled); wherePredicate = wherePredicate.And(x => startsWith3Chars.Matches(x.MATERIALUID).Count > 0); But now I have the need to do this filt...
I am looking for an approach for finding the code between the base class identifier colon and the opening curly brace of a class that's been that's been stored into a string literal. By this I mean that I have a class public class Class : BaseClass { } That's been stored as a string string classString = "public class Class : Ba...
Hi, I am trying to migrate some code from an old naming scheme to the new one the old naming scheme is: int some_var_name; New one is int someVarName_: So what I would ilke is some form of sed / regexy goodness to ease the process. So fundamentally what needs to happen is: find lower case word with contained _ replace underscore w...
I'm looking to match this pattern: ((##.##.##)) Any series of Numbers/Decimals, surrounded by "((" and "))", and preceded by one whitespace There can't be any characters in the middle except digits and periods. Right now I have "\s(\(){2}[\d\.]+(\)){2}" but i'm not getting any matches... ...
I'm writing a WordPress plugin, and one of the features is removing duplicate whitespace. My code looks like this: return preg_replace('/\s\s+/u', ' ', $text, -1, $count); I don't understand why I need the u modifier. I've seen other plugins that use preg_replace and don't need to modify it for Unicode. I believe I have a default in...