Computer Science, asked by nivinivi8164, 1 month ago

Write a Regex that matches 4-6 characters of base64 string, appended by . or

- and then followed by an email with an alphanumeric username component,

with email domains ending with .in or .co.uk​

Answers

Answered by 20226c
0

Answer:

ok

Explanation:

pls make me brainliest

Answered by Yashraj2022sl
0

Answer:

The base64-encoded string regular expression /(?:[A-Za-z\d+/]{4})*(?:[A-Za-z\d+/]{3}=|[A-Za-z\d+/]{2}==)/

Explanation:

Base64-encoded string regular expression

Let's begin by enclosing all the permitted characters in square brackets. The symbols + and forward slash / are also permitted, along with the letters A-Z, a-z, 0-9:

/[A-Za-z\d+/]/

The {4} means we want exactly 4 of these characters.

/[A-Za-z\d+/]{4}/

We must group the above phrase into a non-capture group (?:...) and add a zero-or-more quantifier * behind the group to indicate that we'll accept zero or more of this 4-character group in order to say that we'd accept any multiple of four.

/(?:[A-Za-z\d+/]{4})*/

A multiple of 4 is 1 less than the character number.

Let's start by stating that we will accept 3 characters from our character group in the scenario where the number of characters is 1 less than a multiple of 4 [A-Za-z\d+/] :

/[A-Za-z\d+/]{3}/

We can specify this as follows:

/[A-Za-z\d+/]{3}=/

A multiple of 4 is 2 less than the character number.

This component functions almost exactly like the component we just discussed. Let's start by stating that in this instance, we'll accept 2 characters from the character group

[A-Za-z\d+/]:

/[A-Za-z\d+/]{2}/

To make up for the two remaining characters, the string must be padded with two equals signs ==, which we can add as follows:

/[A-Za-z\d+/]{2}==/

Combining everything:

/(?:[A-Za-z\d+/]{4})*(?:[A-Za-z\d+/]{3}=|[A-Za-z\d+/]{2}==)/

Therefore, the base64-encoded string regular expression /(?:[A-Za-z\d+/]{4})*(?:[A-Za-z\d+/]{3}=|[A-Za-z\d+/]{2}==)/

#SPJ3

Similar questions