Hi,
   Timeout: no idea. But check out re.compile and re.iterfind as they might
   speed things up. I often compile a regex once upon import, then use it in
   functions
   On 27 Nov 2020 13:33, Shahique Khan <shahiquzz...@gmail.com> wrote:

     Hi Team,

     I have noticed if our regex sometimes does not give a result and on that
     time regex took more time in returning response (empty response).

     My Question is can we set a timeout parameter (in seconds/millisecond)
     with
     re.find or anywhere in code to avoid CPU consumption if regex takes more
     time in execution.

     Below is the example, which take more time in execution: (in this case
     can
     we set timeout to kill the execution to avoid CPU consumption)

     regex = r'data-stid="section-room-list"[\s\S]*?>\s*([\s\S]*?)\s*' \
            
     
r'(?:class\s*=\s*"\s*sticky-book-now\s*"|</ul>\s*</section>|id\s*=\s*"Location")'
     rooms_blocks_to_be_replace = re.findall(regex, html_template)

     Please help me, I will be very thankful for this.

     Thanks,
     --
     https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to