I have something like this https://regexr.com/3ja39 and the question is: How should I change regexp to get value beetween lot and ohm but without lot and ohm I want to get only value which is beetewm
Asked
Active
Viewed 56 times
-3
-
1What language? Also, you shouldn't parse HTML with regex: [H̸̡̪̯ͨ͊̽̅̾̎Ȩ̬̩̾͛ͪ̈́̀́͘ ̶̧̨̱̹̭̯ͧ̾ͬC̷̙̲̝͖ͭ̏ͥͮ͟Oͮ͏̮̪̝͍M̲̖͊̒ͪͩͬ̚̚͜Ȇ̴̟̟͙̞ͩ͌͝S̨̥̫͎̭ͯ̿̔̀ͅ](https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags). Also, include all the relevant information in your question, not external links. – ctwheels Jan 16 '18 at 20:48
-
Javascript, like in regexr.com – XnIcRaM Jan 16 '18 at 20:49
-
and I don't know better online html parser – XnIcRaM Jan 16 '18 at 20:50
-
You simply need to get the contents of the first capture group. What you're seeking is in that value. Use `exec()` – ctwheels Jan 16 '18 at 20:51
-
Possible duplicate of [How do you access the matched groups in a JavaScript regular expression?](https://stackoverflow.com/questions/432493/how-do-you-access-the-matched-groups-in-a-javascript-regular-expression) – ctwheels Jan 16 '18 at 20:51
-
I want use this regex only few times and only online in regexr.com (need get list of resistors values given on page) – XnIcRaM Jan 16 '18 at 20:53
-
Just copy paste everything into https://regex101.com (it'll show you captures) or use `$1` instead of `$&` – ctwheels Jan 16 '18 at 20:54
-
I always use regex101.com but now I got ERR_CONNECTION_TIMED_OUT when I try open this page :( – XnIcRaM Jan 16 '18 at 20:56
-
Delete your browser history & cookies. – ctwheels Jan 16 '18 at 20:56
-
It's not help I even try two diffrent browser – XnIcRaM Jan 16 '18 at 20:58
-
It may be down at the moment – ctwheels Jan 16 '18 at 20:58
1 Answers
0
Use parenthesis in Regex to capture specific text between other characters, if this is always going to be a numeric between lot- and -ohm you could do something like: .?lot-(\d.)-ohm.*?
I like this site, it has a great cheat sheet on the regex characters and what they do Regex Cheatsheet!

Ryan Wilson
- 10,223
- 2
- 21
- 40
-
But that's a C# regex cheat sheet. Some of the information in there isn't relevant to JavaScript. Also, it doesn't contain all C# regex tokens, so it's a pretty bad cheat sheet. – ctwheels Jan 16 '18 at 20:52
-
I find it weird that the new cheat sheet you posted shows the quantifier as `{2, 5}` even though that's not valid and it shouldn't have a space `{2,5}` – ctwheels Jan 16 '18 at 20:56
-