skip to Main Content

What python script will find the locations of every backslash inside of an HTML tag and replace the backslash with a forward slash?

Test Input <!DOCTYPE html> <html> <head> <title>This is a title</title> <head> <body> <div> <p>H/e/l/l/o abcdefgw/o/r/l/d!</p> </div> <body> <html> Test Output <!DOCTYPE html> <html> <head> <title>This is a title</title> </head> <body> <div> <p>H/e/l/l/o abcdefgw/o/r/l/d!</p> </div> </body> </html> We do not want…

VIEW QUESTION

Convert the text input file to JSON in Python

I am using python to convert the text input file to json. My Code: import json import re filename = "text.txt" text = {} pattern = re.compile(r's*([^=t]+)s*=s*(.*)') with open(filename, encoding='utf8') as file: for line in file: match = pattern.match(line.strip()) if…

VIEW QUESTION

Php versions – Check URL/IP with port with regex

My Java 11/Android app has to check if the URL/IP the user entered could theoretically be valid (using myURL.trim().matches(regex)). What should be valid (including variations): stackoverflow.com http://stackoverflow.com http://amazon.co.uk https://www.amazon.co.uk ftp://10.1.1.9 10.1.1.9:1234 http://10.1.1.9:1234/bla What shouldn't be valid: http://bla bla "---" (without…

VIEW QUESTION
Back To Top
Search