How to place html tags inside javascript string?

I have this code right here: generation.innerHTML= "<!DOCTYPE html>\n"+ "<html>\n"+ "<head>\n"+ "<style>\n"+ cinput+ "\n<\/style>"+ "\n<\/head>"+ "<body>\n"+ hinput+ "\n<script>\n"+ jinput+ "\n<\/script>\n"+ "<\/body>"+ "<\/html>"; But the doctype, html, head and body tags dissapear when I console log it, but when viewing it as a P element, all of the tags go away and leave the hinput, cinput,… Read More How to place html tags inside javascript string?

Exlude constant substring while searching for different substring remaining original indexing

I’d like to find (original) index of substring e.g. "cac" while ignoring some other (constant) substring e.g. "<ee>". import re string = "aaac<ee>acbbb" pattern=re.compile("<ee>") # pattern to exlude re.search("cac", pattern.sub("",string)) I’ve tried using regex, but this gives me only the index of newly established string (pattern excluding): <re.Match object; span=(3, 6), match=’cac’> Is there any… Read More Exlude constant substring while searching for different substring remaining original indexing

Regex to match string and special characters

I am new to regex and I want to know how to generate a pattern with letters including special characters and Capital letters from 3 letters up. Suppose I have a string like this: my_string = ‘Syrians/NORP, Turkish/NORP, Turkish/NORP, Turkish/NORP, the last 2 , 3 years/DATE, Turkey/LOC’ What I have tried: my_new_string = re.findall(‘[\w+\,]+/[A-Z]{4}’, my_string)… Read More Regex to match string and special characters

How to convert string on variable in class?

how can i get access to variable in class using string? class GameShop: ManaPotion = "ManaPotion" priceManaPotion = 50 HealthPotion = "HealthPotion" priceHealthPotion = 50 StaminaPotion = "StaminaPotion" priceStaminaPotion = 50 itemy = { ManaPotion: priceManaPotion, HealthPotion: priceHealthPotion, StaminaPotion: priceStaminaPotion, } shop = GameShop print(GameShop.priceHealthPotion) product_name = input("Product Name") print(f'{GameShop}’ + ‘.price’ + f'{product_name}’ )… Read More How to convert string on variable in class?