hoho Posted March 28, 2018 Report Posted March 28, 2018 Palīdziet lūdzu uzrakstīt regex, kas no html faila visiem attēliem noņem height. Piemērs: ..... <img src="t.jpg" style="width:1000px; height: 300px"> ....... Heigh ir iekš style atribūta. Quote
Alnis Posted March 28, 2018 Report Posted March 28, 2018 Lai citiem tagiem nenoņemtu height https://regex101.com/r/HSiAMt/1 Quote
daGrevis Posted March 29, 2018 Report Posted March 29, 2018 Ar regexiem parsējam HTML? :) Neiet, ja <img title="ā" style="height: 123px" /> . Quote
Alnis Posted March 29, 2018 Report Posted March 29, 2018 /<img[\. .=":;a-zA-Z0-9ĀČĒĢĪĶĻŅŌŖŠŪŽzāčēģīķļņōŗšūž]+(height:[ 0-9]+px)+/g https://regex101.com/r/HSiAMt/2 Quote
indoom Posted March 29, 2018 Report Posted March 29, 2018 /<img [^<]*(height:[ \d]+px;?)[^>]*>/g https://regex101.com/r/HSiAMt/3 Quote
daGrevis Posted March 29, 2018 Report Posted March 29, 2018 Neiet <img title="1<2" style="height: 123px" />. Quote
briedis Posted March 29, 2018 Report Posted March 29, 2018 3 hours ago, daGrevis said: Neiet <img title="1<2" style="height: 123px" />. nekorekts html, title="1<2" Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.