CDN - a content delivery network is a system of geographically distributed servers used to transport media files. The purpose of the CDN is to host live streaming videos to users. CDN works like amazon warehouse. If closest edge server does have resource cached, it will deliver it to the user. If not, it will deliver the media by requesting to another network. (Think of it like globally connected highways for data).
Advantage of CDNS - scalability, speed, quality and security.
When CDNs are not needed - Small audience, limited budget.
Every year people are abandoning traditional satellite and cable services and switching to live streaming.(favoring towards netflix over broadbands).
.ts, .mp4, there are various media formats and it can be bothersome and burden towards memory to have all these different formats available for end users. So came up with the solution of cmaf, making a universal media format for all media content.
CMAF also provides low latency, by dividing original media file into small pieces called chunks.
Find the Unicode character specified by a hexadecimal number dddd
1. .test()
var str = "Hello world";
var testing = /world/;
testing.test(str); //outputs true
can add | for multiple search
letpetString = "James has a pet cat.";
letpetRegex = /dog|cat|bird|fish/; // Change this line
letresult = petRegex.test(petString);
add i on the back to ignore upperlower case
letmyString = "freeCodeCamp";
letfccRegex = /freecodecamp/i; // Change this line
letresult = fccRegex.test(myString);
2. .match()
extracts the string
add g on the back for multiple results
To search or extract a pattern more than once, you can use thegflag.
let repeatRegex =/Repeat/g;
testStr.match(repeatRegex);
// Returns ["Repeat", "Repeat", "Repeat"]
The wildcard character.will match any one character.
[] Character classes allow you to define a group of characters you wish to match by placing them inside square ([and]) brackets.
Inside a character set, you can define a range of characters to match using a hyphen character:-.
To create a negated character set, you place a caret character (^) after the opening bracket and before the characters you do not want to match.
For example,/[^aeiou]/gimatches all characters that are not a vowel. Note that characters like.,!,[,@,/and white space are matched - the negated vowel character set only excludes the vowel characters.
+ to look for a character one or more time
* to look for a character zero or more time
In an earlier challenge, you used the caret character (^) inside a character set to create a negated character set in the form[^thingsThatWillNotBeMatched]. Outside of a character set, the caret is used to search for patterns at the beginning of strings.
You can search the end of strings using the dollar sign character$at the end of the regex.
The closest character class in JavaScript to match the alphabet is\w. This shortcut is equal to[A-Za-z0-9_]. This character class matches upper and lowercase letters plus numbers. Note, this character class also includes the underscore character (_).
\w = a-zA-Z0-9
\W = not \w
\d = 0-9
\D = not digit
problem 1:
1) Usernames can only use alpha-numeric characters.
2) The only numbers in the username have to be at the end. There can be zero or more of them at the end.
3) Username letters can be lowercase and uppercase.
4) Usernames have to be at least two characters long. A two-character username can only use alphabet letters as characters.
letusername = "JackOfAllTrades";
letuserCheck = /^[a-z]([0-9]{2,}|[a-z]+\d*)$/i; // Change this line
letresult = userCheck.test(username);
^- start of input
[a-z]- first character is a letter
[0-9]{2,0}- ends with two or more numbers
|- or
[a-z]+- has one or more letters next
\d*- and ends with zero or more numbers
$- end of input
i- ignore case of input
------
to match only the string"hah"with the letteraappearing at least3times, your regex would be/ha{3,}h/.
t{3,6} = 3 to 6
t{3,} = 3 or more
t{3} = 3
? = zero or more
A positive lookahead will look to make sure the element in the search pattern is there, but won't actually match it. A positive lookahead is used as(?=...)where the...is the required part that is not matched.
On the other hand, a negative lookahead will look to make sure the element in the search pattern is not there. A negative lookahead is used as(?!...)where the...is the pattern that you do not want to be there. The rest of the pattern is returned if the negative lookahead part is not present.