nicuf

Batch

Jun 11th, 2021 (edited)
398
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.42 KB | None | 0 0
  1. I want to make a Batch Processor (so as to run multiple Regex one by one, in the order I put them). I give you 3 examples, but In the BatchProcessor PY script I will have more than 20 regex (find and replace) to run.
  2.  
  3. There are 3 types of search and Replace that you must consider:
  4.  
  5. 1. The simple search: -----------------
  6.  
  7. FIND:        Abracadabra, Who Are You
  8. Replace by:  Everythin you want
  9.  
  10. 2. The simple regex search: -----------------
  11.  
  12. FIND:        <title>.*\K\|(.*)(</title>)
  13. Replace by:  \x20|\x20Something Else \(zh\)\x20\2
  14.  
  15. 3. The regex search (with .matches newsline) -----------------
  16.  
  17. FIND:        (<link rel="canonical" href="(.*?)" />.*?)(<meta property="og:url" content=").*?("\/>)
  18. Replace by:  \1\3\2\4
  19.  
  20. -----------HTML CODE FOR TESTING THESE REGEX, (copy thie line exatly how they are in some new txt file)----
  21.  
  22. <title>Abracadabra, Who Are You?| Neculai Fantanaru (en)</title>
  23.  
  24. <link rel="canonical" href="https://neculaifantanaru.com/fr/abracadabra-qui-etes-vous.html" />
  25.  
  26. <meta name="keywords" content="abracadabra, qui êtes-vous?"/>
  27.  
  28. <meta property="og:url" content="MAMA.html"/>
  29.  
  30. ----------------------------------------------
  31.  
  32.  
  33. ---Maybe will help you this----
  34.  
  35. https://mail.python.org/pipermail/python-ideas/2010-March/006897.html
  36.  
  37. https://www.geeksforgeeks.org/pattern-matching-python-regex/
  38.  
  39. https://www.codeproject.com/Tips/5280511/Regexplus-Extended-Regular-Expression-Engine
  40.  
  41.  
  42.  
  43.  
Add Comment
Please, Sign In to add comment