“Имя изображения проверка с использованием regex javascript” Ответ

Имя изображения проверка с использованием regex javascript

# Python3 program to validate
# image file extension using regex
import re
 
# Function to validate
# image file extension . 
def imageFile(str):
 
    # Regex to check valid image file extension.
    regex = "([^\\s]+(\\.(?i)(jpe?g|png|gif|bmp))$)"
     
    # Compile the ReGex
    p = re.compile(regex)
 
    # If the string is empty
    # return false
    if (str == None):
        return False
 
    # Return if the string
    # matched the ReGex
    if(re.search(p, str)):
        return True
    else:
        return False
 
# Driver code
 
# Test Case 1:
str1 = "abc.png"
print(imageFile(str1))
 
# Test Case 2:
str2 = "im.jpg"
print(imageFile(str2))
 
# Test Case 3:
str3 = ".gif"
print(imageFile(str3))
 
# Test Case 4:
str4 = "abc.mp3"
print(imageFile(str4))
 
# Test Case 5:
str5 = " .jpg"
print(imageFile(str5))
 
# This code is contributed by avanitrachhadiya2155
YVAN AUGUSTE NGOAHITSI

Имя изображения проверка с использованием regex javascript

# Python3 program to validate
# image file extension using regex
import re
 
# Function to validate
# image file extension . 
def imageFile(str):
 
    # Regex to check valid image file extension.
    regex = "([^\\s]+(\\.(?i)(jpe?g|png|gif|bmp))$)"
     
    # Compile the ReGex
    p = re.compile(regex)
 
    # If the string is empty
    # return false
    if (str == None):
        return False
 
    # Return if the string
    # matched the ReGex
    if(re.search(p, str)):
        return True
    else:
        return False
 
# Driver code
 
# Test Case 1:
str1 = "abc.png"
print(imageFile(str1))
 
# Test Case 2:
str2 = "im.jpg"
print(imageFile(str2))
 
# Test Case 3:
str3 = ".gif"
print(imageFile(str3))
 
# Test Case 4:
str4 = "abc.mp3"
print(imageFile(str4))
 
# Test Case 5:
str5 = " .jpg"
print(imageFile(str5))
 
# This code is contributed by avanitrachhadiya2155
YVAN AUGUSTE NGOAHITSI

Имя изображения проверка с использованием regex javascript

# Python3 program to validate
# image file extension using regex
import re
 
# Function to validate
# image file extension . 
def imageFile(str):
 
    # Regex to check valid image file extension.
    regex = "([^\\s]+(\\.(?i)(jpe?g|png|gif|bmp))$)"
     
    # Compile the ReGex
    p = re.compile(regex)
 
    # If the string is empty
    # return false
    if (str == None):
        return False
 
    # Return if the string
    # matched the ReGex
    if(re.search(p, str)):
        return True
    else:
        return False
 
# Driver code
 
# Test Case 1:
str1 = "abc.png"
print(imageFile(str1))
 
# Test Case 2:
str2 = "im.jpg"
print(imageFile(str2))
 
# Test Case 3:
str3 = ".gif"
print(imageFile(str3))
 
# Test Case 4:
str4 = "abc.mp3"
print(imageFile(str4))
 
# Test Case 5:
str5 = " .jpg"
print(imageFile(str5))
 
# This code is contributed by avanitrachhadiya2155
YVAN AUGUSTE NGOAHITSI

Имя изображения проверка с использованием regex javascript

# Python3 program to validate
# image file extension using regex
import re
 
# Function to validate
# image file extension . 
def imageFile(str):
 
    # Regex to check valid image file extension.
    regex = "([^\\s]+(\\.(?i)(jpe?g|png|gif|bmp))$)"
     
    # Compile the ReGex
    p = re.compile(regex)
 
    # If the string is empty
    # return false
    if (str == None):
        return False
 
    # Return if the string
    # matched the ReGex
    if(re.search(p, str)):
        return True
    else:
        return False
 
# Driver code
 
# Test Case 1:
str1 = "abc.png"
print(imageFile(str1))
 
# Test Case 2:
str2 = "im.jpg"
print(imageFile(str2))
 
# Test Case 3:
str3 = ".gif"
print(imageFile(str3))
 
# Test Case 4:
str4 = "abc.mp3"
print(imageFile(str4))
 
# Test Case 5:
str5 = " .jpg"
print(imageFile(str5))
 
# This code is contributed by avanitrachhadiya2155
YVAN AUGUSTE NGOAHITSI

Имя изображения проверка с использованием regex javascript

# Python3 program to validate
# image file extension using regex
import re
 
# Function to validate
# image file extension . 
def imageFile(str):
 
    # Regex to check valid image file extension.
    regex = "([^\\s]+(\\.(?i)(jpe?g|png|gif|bmp))$)"
     
    # Compile the ReGex
    p = re.compile(regex)
 
    # If the string is empty
    # return false
    if (str == None):
        return False
 
    # Return if the string
    # matched the ReGex
    if(re.search(p, str)):
        return True
    else:
        return False
 
# Driver code
 
# Test Case 1:
str1 = "abc.png"
print(imageFile(str1))
 
# Test Case 2:
str2 = "im.jpg"
print(imageFile(str2))
 
# Test Case 3:
str3 = ".gif"
print(imageFile(str3))
 
# Test Case 4:
str4 = "abc.mp3"
print(imageFile(str4))
 
# Test Case 5:
str5 = " .jpg"
print(imageFile(str5))
 
# This code is contributed by avanitrachhadiya2155
YVAN AUGUSTE NGOAHITSI

Имя изображения проверка с использованием regex javascript

# Python3 program to validate
# image file extension using regex
import re
 
# Function to validate
# image file extension . 
def imageFile(str):
 
    # Regex to check valid image file extension.
    regex = "([^\\s]+(\\.(?i)(jpe?g|png|gif|bmp))$)"
     
    # Compile the ReGex
    p = re.compile(regex)
 
    # If the string is empty
    # return false
    if (str == None):
        return False
 
    # Return if the string
    # matched the ReGex
    if(re.search(p, str)):
        return True
    else:
        return False
 
# Driver code
 
# Test Case 1:
str1 = "abc.png"
print(imageFile(str1))
 
# Test Case 2:
str2 = "im.jpg"
print(imageFile(str2))
 
# Test Case 3:
str3 = ".gif"
print(imageFile(str3))
 
# Test Case 4:
str4 = "abc.mp3"
print(imageFile(str4))
 
# Test Case 5:
str5 = " .jpg"
print(imageFile(str5))
 
# This code is contributed by avanitrachhadiya2155
YVAN AUGUSTE NGOAHITSI

Имя изображения проверка с использованием regex javascript

# Python3 program to validate
# image file extension using regex
import re
 
# Function to validate
# image file extension . 
def imageFile(str):
 
    # Regex to check valid image file extension.
    regex = "([^\\s]+(\\.(?i)(jpe?g|png|gif|bmp))$)"
     
    # Compile the ReGex
    p = re.compile(regex)
 
    # If the string is empty
    # return false
    if (str == None):
        return False
 
    # Return if the string
    # matched the ReGex
    if(re.search(p, str)):
        return True
    else:
        return False
 
# Driver code
 
# Test Case 1:
str1 = "abc.png"
print(imageFile(str1))
 
# Test Case 2:
str2 = "im.jpg"
print(imageFile(str2))
 
# Test Case 3:
str3 = ".gif"
print(imageFile(str3))
 
# Test Case 4:
str4 = "abc.mp3"
print(imageFile(str4))
 
# Test Case 5:
str5 = " .jpg"
print(imageFile(str5))
 
# This code is contributed by avanitrachhadiya2155
YVAN AUGUSTE NGOAHITSI

Имя изображения проверка с использованием regex javascript

# Python3 program to validate
# image file extension using regex
import re
 
# Function to validate
# image file extension . 
def imageFile(str):
 
    # Regex to check valid image file extension.
    regex = "([^\\s]+(\\.(?i)(jpe?g|png|gif|bmp))$)"
     
    # Compile the ReGex
    p = re.compile(regex)
 
    # If the string is empty
    # return false
    if (str == None):
        return False
 
    # Return if the string
    # matched the ReGex
    if(re.search(p, str)):
        return True
    else:
        return False
 
# Driver code
 
# Test Case 1:
str1 = "abc.png"
print(imageFile(str1))
 
# Test Case 2:
str2 = "im.jpg"
print(imageFile(str2))
 
# Test Case 3:
str3 = ".gif"
print(imageFile(str3))
 
# Test Case 4:
str4 = "abc.mp3"
print(imageFile(str4))
 
# Test Case 5:
str5 = " .jpg"
print(imageFile(str5))
 
# This code is contributed by avanitrachhadiya2155
YVAN AUGUSTE NGOAHITSI

Имя изображения проверка с использованием regex javascript

# Python3 program to validate
# image file extension using regex
import re
 
# Function to validate
# image file extension . 
def imageFile(str):
 
    # Regex to check valid image file extension.
    regex = "([^\\s]+(\\.(?i)(jpe?g|png|gif|bmp))$)"
     
    # Compile the ReGex
    p = re.compile(regex)
 
    # If the string is empty
    # return false
    if (str == None):
        return False
 
    # Return if the string
    # matched the ReGex
    if(re.search(p, str)):
        return True
    else:
        return False
 
# Driver code
 
# Test Case 1:
str1 = "abc.png"
print(imageFile(str1))
 
# Test Case 2:
str2 = "im.jpg"
print(imageFile(str2))
 
# Test Case 3:
str3 = ".gif"
print(imageFile(str3))
 
# Test Case 4:
str4 = "abc.mp3"
print(imageFile(str4))
 
# Test Case 5:
str5 = " .jpg"
print(imageFile(str5))
 
# This code is contributed by avanitrachhadiya2155
YVAN AUGUSTE NGOAHITSI

Имя изображения проверка с использованием regex javascript

# Python3 program to validate
# image file extension using regex
import re
 
# Function to validate
# image file extension . 
def imageFile(str):
 
    # Regex to check valid image file extension.
    regex = "([^\\s]+(\\.(?i)(jpe?g|png|gif|bmp))$)"
     
    # Compile the ReGex
    p = re.compile(regex)
 
    # If the string is empty
    # return false
    if (str == None):
        return False
 
    # Return if the string
    # matched the ReGex
    if(re.search(p, str)):
        return True
    else:
        return False
 
# Driver code
 
# Test Case 1:
str1 = "abc.png"
print(imageFile(str1))
 
# Test Case 2:
str2 = "im.jpg"
print(imageFile(str2))
 
# Test Case 3:
str3 = ".gif"
print(imageFile(str3))
 
# Test Case 4:
str4 = "abc.mp3"
print(imageFile(str4))
 
# Test Case 5:
str5 = " .jpg"
print(imageFile(str5))
 
# This code is contributed by avanitrachhadiya2155
YVAN AUGUSTE NGOAHITSI

Ответы похожие на “Имя изображения проверка с использованием regex javascript”

Вопросы похожие на “Имя изображения проверка с использованием regex javascript”

Больше похожих ответов на “Имя изображения проверка с использованием regex javascript” по Python

Смотреть популярные ответы по языку

Смотреть другие языки программирования