5
votes
2answers
47 views

youtube video id from url

I have obtained these codes from other stackoverflow pages to correct youtube links but they dont work for my url: https://www.youtube.com/watch?v=r2dRQHJ-aAk code: <script> ...
1
vote
1answer
30 views

Regex for change case when click in a button

I need to change case when I select part of a text and click in a button in javascript/jquery this code doesn't work for a selected part $("#button").click(function() { value = "some selected ...
1
vote
3answers
50 views

Regular expression to include all specific pattern and exclude only one case

I am working something to exclude some URL. I want to expect all URLs with the pattern /google.com/, except for /login.google.com/ So: account.google.com should pass google.com should pass ...
1
vote
1answer
30 views

Javascript efficient parsing of css selector

What would be the most efficient way of parsing a css selector input string, that features any combination of: [key=value] : attributes, 0 to * instances #id : ids, 0 to 1 instances ...
0
votes
3answers
61 views

Use dynamic (variable) string as regex pattern in JavaScript

I want to add a (variable) tag to values with regex, the pattern works fine with PHP but I have troubles implementing it into JavaScript. The pattern is (value is the variable): ...
1
vote
6answers
84 views

How to parse a string containing text for a number/float in javascript?

I'm trying to build a javascript function capable of parsing a sentence and returning a number. Here is a jsFiddle I've setup for the test cases below - 'I have 1 pound' -> 1 'I have £3.50 to ...
0
votes
5answers
62 views

Is it possible to cut off the beginning of a string using regex?

I have a string which contains a path, such as /foo/bar/baz/hello/world/bla.html Now, I'd like to get everything from the second-last /, i.e. the result shall be /world/bla.html Is this possible ...
1
vote
7answers
59 views

Match string using regex

I have the following variable: var test = category~[330526|330519]^Size{1}~[m] How do I match just to get category~[330526|330519] using regex. This value can also change so it could be ...
-2
votes
2answers
27 views

JavaScript regex match id in innerHTML [on hold]

I managed to get all the text with .innerHTML, code should match all IDs which have pattern: "sens[number]" Is it possible to get the number? Is there some way around? And please no jQuery, thank you! ...
1
vote
2answers
83 views

How to get JSON data from the text? [on hold]

I have a string, something like this: ...
0
votes
4answers
67 views

How to insert commas in numbers in an html template?

I have an html template, I want to make a generalize function that itself finds all the numbers in my template and insert comma after every 3 digits. Currently I am using this function which may take ...
2
votes
3answers
40 views

Can't match this regular expression in Javascript

I need to apply a regexp for replacing a block of a string. this is my code: var style = "translate(-50%, -50%) translate3d(3590px, 490px, 0px) rotateX(0deg) rotateY(0deg) rotateZ(0deg) scale(1)"; ...
1
vote
1answer
27 views

Remove whitespaces in a function name before and after parentheses, even in arguments

I am just a noob when it comes to regex in JavaScript, I wanted to remove white-spaces everywhere in a function before and after parentheses with any number of arguments, even between arguments. eg: ...
2
votes
2answers
35 views

replace 2 escaped linefeeds / new lines “\n”

How come I can replace one escaped newline \n from a text area with anything... str1 = str1.replace(/\n /g,"7 "); but it does not work with two of them? str1 = str1.replace(/\n\n /g,"7 ...
3
votes
2answers
36 views

Sublime text find and replace with regex to convert jquery live() event to on()

I am doing an upgrade to the latest jQuery and I have a large number of js files that I need to update. Mostly the conversion of the live() event to on() (there are hundreds) In Sublime text, I am ...

1 2 3 4 5 555
15 30 50 per page