Implement mode pictures in regular expressions (strengthen) .asp

xiaoxiao2021-03-06  19

Customers require that the original IMG is already in the properties, depressed, continuing to change

code show as below:

Function Shownew (Content, NTYPE)

Shownew = ""

IF (ntype = 1) THEN

Shownew = shownew & "

" Shownew = shownew & "" Shownew = shownew & " "Shownew = Shownew &"
"& ShowPic &" "Shownew = Shownew &" "Shownew = Shownew &"
"& Onlyword (Content) &" "Shownew = Shownew &" "Shownew = Shownew &" "

Elseif (ntype = 2) THEN

Shownew = shownew & "

" & online "&" shownew = shownew & " "Shownew = Shownew &" "Shownew = ShowneW &"
"& ShowPic &" "Shownew = ShowneW &" "Shownew = Shownew &" "

Elseif (ntype = 3) THEN

Shownew = shownew & "

"

Shownew = shownew & "

" Shownew = Shownew & "
" & showpic (content) & ""

Shownew = ShowneW & "

" & Onlyword & "" Shownew = Shownew & "" Shownew = Shownew & ""

Elseif (ntype = 4) THEN

Shownew = shownew & "

"

Shownew = shownew & "

"

Shownew = ShowneW & "

" & "Shownew = Shownew &" "& showpic &" "

Shownew = shownew & "" Shownew = shownew & "" else shownew = shownew & contenten

END FUNCTION

'Show the extracted picture Function ShowPic (strng)

Set regex2 = new regexp

Regex2.pattern = "(SRC =) ('|" & chr (34) & "|)? (. [^' | |" & chr (34) & "] *) (/.) (JPG | GIF | PNG | BMP | JPEG) ('| "& chr (34) &" | |>) "" Setting mode. Regex2.ignorecase = true 'Set whether you distinguish between characters. Regex2.global = true 'Sets global availability. ShowPic = "" imageURL = regexpexecute (strng)

ImageURLS = Split (ImageURL, {| LDIV |} ")

For i = lbound (imageurls) to (ubound (imageurls) - 1)

Set matches2 = regex2.execute (imageURLS (i)) 'performs a search.

FOR Each Match2 in matches2 'traverses matching collection.

'Full IMG tag newPic = lcase (imageURLS (i))

'If you don't have a custom Border increase border = 0, other original properties are retained

IF (INSTR (NewPic, "Border") = false) THEN NewPic = Left (NewPic, LEN (NewPic) -1) "Border = '0'> IF (Instr (NewPic," Width ") = false) THEN NewPic = Left (newPic, newwpic) -1) "width = '200'>" newPic = "" & newpic & ""

ShowPic = showPic & NewPic Next

NEXT

Set regex2 = Nothingend function

'Extract pictures from content Function Regexpexecute (strng) Dim Regex, Match, Matches' Establishing Variables. Set regex = new regexp 'establishes regular expressions.

Regex.pattern = "(. [^ <] *) (SRC =) ('|" & chr (34) & "|)? (. [^' | / s |" & chr (34) & "] *) (/.) (JPG | GIF | PNG | BMP | JPEG) ('| "& chr (34) &" | / s |>) (. [^>] *) (>)' Setting mode.

Regex.ignoreCase = true 'Set whether you distinguish between characters. Regex.global = true 'Sets global availability. Set matches = regex.execute (strng) 'Executes your search. FOR Each Match In Matches' traverses matching collection. VALUES = VALUES & MATCH.VALUE & "{| LDIV |}" Next Regexpexecute = VALUESEND FUNCTION

'Remove the content in the contents of the code Function Onlyword (STRNG) set re = new regexp Re.ignoreCase = true re.global = true re.pattern = "(. [^ <] *) (Src =) (SRC =) '| "& Chr (34) &" |)? (. [^' | / S | "& chr (34) &"] *) (/.) (JPG | GIF | PNG | BMP | JPEG) ('| " & Chr (34) & "| / s |>) (. [^>] *) (>)" 'Setting mode. ONLYWORD = Re.Replace (strng, ") set re = Nothing

END FUNCTION

转载请注明原文地址:https://www.9cbs.com/read-44564.html

New Post(0)
CopyRight © 2020 All Rights Reserved
Processed: 0.050, SQL: 9