D
D
Doxi2017-05-09 01:15:45
Regular Expressions
Doxi, 2017-05-09 01:15:45

How to quickly find the desired element on the site?

The bottom line is that there are products on the site, and they are updated in real time (that is, new products are added) and I need to find a product with a certain price (for example, below 20).
At the moment I have all this implemented using setInterval and $.each, that is, after a certain time interval, all the goods and their prices are checked for me, and then it is checked whether the price of the goods is below 20. Is it possible to somehow simplify all this or how to implement it differently, so that, for example, there would be only that product whose price is below 20 without checking all the others

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
Nurlan, 2018-07-04
@daager

If I understand you correctly:
1) https://regex101.com/r/mb4TIr/1
2)

check("__");

  function check($string){
    $arr=array_unique(str_split($str,1));
    return(count($arr)==1 AND $arr[0]=='_')
  }

3) etc
PS Your question can be formulated in a simpler way: you only need a string of underscores.

A
Alexey Ukolov, 2018-07-04
@alexey-m-ukolov

only when the line starts at 1 or more below. underlined with additional provided that neither before them, nor between them, nor after them was there any character
Well, does the line start with underscores or is there nothing in it except underscores? Because "there was no character after them" - this means that in general there is nothing in the line except underscores. And then the regular expression is simple:^_+$

P
profesor08, 2017-05-09
@profesor08

Try using some js framework like vue.js. Your problem will be solved with a couple of lines of code.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question