Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

grepper valid base64

// Check if string is Base64 encoded
// Source answer provided by: https://stackoverflow.com/users/549471/anders-marzi-tornblad

const b64Validator = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;

if(b64Validator.test(stringToTest) {
  // etc
}

// Explanation:
/*
    ^                          # Start of input
    ([0-9a-zA-Z+/]{4})*        # Groups of 4 valid characters decode
                               # to 24 bits of data for each group
    (                          # Either ending with:
        ([0-9a-zA-Z+/]{2}==)   # two valid characters followed by ==
        |                      # , or
        ([0-9a-zA-Z+/]{3}=)    # three valid characters followed by =
    )?                         # , or nothing
    $                          # End of input
*/
Comment

PREVIOUS NEXT
Code Example
Javascript :: Introdução ao nodeJs 
Javascript :: angular amber theme 
Javascript :: angular reactive input required based on previous value 
Javascript :: ryan dahl 
Javascript :: how to disable all buttons in javascript 
Javascript :: jest regex jsx tsx js ts 
Javascript :: current time in javascript 
Javascript :: check the checkbox using javascript 
Javascript :: react npm build 
Javascript :: first remove active class from classlist and append to current element using javascript 
Javascript :: regex for ip address javascript 
Javascript :: remove the last element of an array javascript 
Javascript :: float js precision 
Javascript :: next js update 
Javascript :: aws beanstalk nodejs redirect http to https 
Javascript :: html2canvas cdn 
Javascript :: react making post request 
Javascript :: remove event listener react hooks 
Javascript :: react native set default ios simulator 
Javascript :: bootstrap js link not working 
Javascript :: Invariant Violation: requireNativeComponent: "RNSScreen" was not found in the UIManager 
Javascript :: timer.tc elixir 
Javascript :: get next month js 
Javascript :: how to check if element is in viewport 
Javascript :: npm react redux logger 
Javascript :: how to get session javascript ws3schools 
Javascript :: higher order functions event 
Javascript :: scrool to top jquerry 
Javascript :: javascript get random item from array 
Javascript :: javascript onclick display none 
ADD CONTENT
Topic
Content
Source link
Name
2+4 =