Trending December 2023 # A Step By Step With Detailed # Suggested January 2024 # Top 16 Popular

You are reading the article A Step By Step With Detailed updated in December 2023 on the website Daihoichemgio.com. We hope that the information we have shared is helpful to you. If you find the content interesting and meaningful, please share it with your friends and continue to follow and support us for the latest updates. Suggested January 2024 A Step By Step With Detailed

Introduction to Google Analytics Setup

Google Analytics is a powerful online analytics tool offered by Google. It empowers website owners, marketers, and businesses to gain valuable insights into their website or mobile app’s performance and user behavior. By tracking and analyzing various metrics, Google Analytics helps you comprehend user engagement and provides data-driven insights for optimizing your online operations.

Key Takeaways

To set up Google Analytics, you need to create a Google Analytics account, define a property to monitor data for your website and obtain a tracking code to collect the necessary information.

The tracking code is crucial because it needs to be inserted into the HTML code of your website.

This allows Google Analytics to gather data regarding user interactions, traffic sources, and other important metrics.

By analyzing this data, you can gain insights and make informed decisions to enhance website speed and improve the overall user experience.

Start Your Free Marketing Course

Digital marketing, conversion rate optimization, customer relationship management & others

How to Setup Google Analytics? [GA4]

If you don’t have a Google Analytics account, you need to create one. When you initiate a new account, Google Analytics 4 is automatically included as a new property. However, it also provides the option to set up Universal Analytics, which can be done by following the simple steps outlined below.

Step 4: In this step, you are required to provide a Property Name for your Google Analytics setup. Additionally, you should select the Reporting Time Zone and Currency that align with your preferences and requirements.

Next, enter the website URL for which you want to set up the analytics. Then, choose whether you want to establish a GA4 plus Universal Analytics Property or solely a Universal Analytics Property.

Step 7: In the “About Your Business” section, select the relevant options for your business, including the Industry Category, business size, and how you plan to utilize Google Analytics for your business.

Step 9:Once you accept the terms, you will be directed to the Web Stream Details screen, where you can find the Measurement ID in the top right corner.

How to Upgrade an Existing Universal Analytics to a GA4 Property?

If you already have a Universal Analytics Property and want to upgrade to Google Analytics 4 (GA4), here are the steps you need to follow to perform the update.

Note: Before proceeding, please double-check that you have selected the correct account in the account field to avoid any potential issues or errors.

Step 5: Upon reaching the screen below, you will find the connected property message along with the property ID

Step 7: The Measurement ID for the GA4 property can be located in the top right corner of the “Web Stream Details” page.

Congratulations!!! You have now successfully upgraded your property to GA4.

To add GA4 tracking code to a website without using Google Tag Manager, you can follow these steps:

Certainly! Here are three ways to add GA4 tracking code to a website using Google Tag Manager:

To connect the Measurement ID of a GA4 property with an existing UA Property in Universal Analytics, you can follow these steps:

To add a new ‘Config’ directive in the existing code on the website, you need to perform the following steps.

To connect the Measurement ID of a GA4 property with an existing UA Property in Universal Analytics, you can follow these steps:

If you already have a Universal Analytics code on your website and wish to add the GA4 Measurement ID, you can connect the GA4 Measurement ID to your Universal Analytics Property by following these steps:

Step 3: In the upper right corner of the “Web Stream Details” page, you will find the GA4 Measurement ID. Copy this ID for further use.

Step 4: To continue, go to your existing Universal Analytics Property and follow these steps:

Step 5: Next, scroll down the page until you find the “Connected Site Tags” option. Select this option to proceed.

Step 6: To create a new site tag and paste the Measurement ID that you created and copied in Step 3, please follow these instructions:

2. To add a new ‘Config’ directive in the existing code on your website, please follow these steps:

If you already have a (gtag.js) analytics code on your website and wish to add the GA4 Measurement ID, you have a second option where you can add a second “config” directive to the existing analytics code. Here’s how you can do it:

The chúng tôi analytics code typically appears on the source page of a website with the following structure:

function gtag(){dataLayer.push(arguments);} gtag(‘js’, new Date()); gtag(‘config’, ‘UA-##########’);

Certainly! To add an additional “config” directive with the GA4 Property “Measurement ID” after line 8 in the chúng tôi code mentioned above, you can modify the code as follows:

Here’s how the code will look after adding an additional “config” directive with the GA4 Property Measurement ID:

function gtag(){dataLayer.push(arguments);} gtag(‘js’, new Date()); gtag(‘config’, ‘UA-##########’); gtag(‘config’, ‘G-Propert ID’);

To add GA4 tracking code to your website using Google Tag Manager, follow these steps:

Sure! Here are the steps to add the GA4 tracking code to your website using Google Tag Manager:

Step 2: Under the “New Tag” section, select the “Add a new tag” option.

Step 4: In this step, select “Google Analytics: GA4 Configuration” as the tag type from the “Choose Tag Type” window.

Step 5: In the “Measurement ID” section, enter your GA4 Measurement ID. Make sure to input the correct ID associated with your GA4 property..

Select the appropriate trigger based on when you want the GA4 Configuration Tag to be triggered. Choose the trigger that aligns with your desired conditions or events.

Step 7: In the “Choose a Trigger” window, you have the option to select triggers such as “All Pages” to make the tag appear on every page of your website. Alternatively, you can create custom triggers based on specific events or conditions. In this case, you have chosen “All Pages” as the trigger for the GA4 Configuration Tag.

Step 11: Check to see if the GA4 Configuration Tag appears in the Tags Fired list.

By following these steps, you should be able to successfully add a GA4 tracking code to your website using Google Tag Manager. Remember to test and verify the setup to ensure accurate tracking of your website data.

Conclusion

In short, installing Google Analytics Setup entails creating an account, adding a property, and collecting a tracking code. We add the tracking code to the website, whether using Universal Analytics or GA4, to start gathering data for analysis and insights.

Recommended Articles

We hope that this EDUCBA information on “Google Analytics Setup” was beneficial to you. You can view EDUCBA’s recommended articles for more information.

You're reading A Step By Step With Detailed

How To Upload A Video To Youtube – Step By Step Guide

YouTube is the biggest video platform worldwide boasting over 2 billion users, 79 percent of whom own a YouTube account.

If you’re a content creator, you can share your music video, vlog, tutorials, or other video content with that massive user base. Plus, if your content is great, you can grow your audience, increase your influence, and monetize your YouTube channel.

Table of Contents

However, getting your content on YouTube isn’t as easy as just recording and editing the video, uploading, and throwing it out into the world. There are many elements involved in setting up, customizing, and uploading a video.

Whether you want to inspire, entertain, educate, or sell something to your target audience, this step-by-step guide will show you how to upload a video to YouTube.

How To Upload a Video To YouTube

Before you can upload a video to YouTube, you need to create a YouTube account or sign in if you already have one. All you need is to create a Google account. Your YouTube account will have a channel where your videos can live on the platform, and viewers can find your video content.

How To Upload a Video To Youtube Using a Browser

Note: Your internet connection and the size of the video file will determine how fast your video will be uploaded. For YouTube, the best video file format is MP4 as this gives you high quality videos that are smaller in size.

Next, fill out the title and description of your video, among other details. If you want your video to rank for specific keywords, this is a good place to enter those keywords based on what your target audience is searching for.

You can also add tags, a custom or auto-generated thumbnail, add your video to a YouTube playlist, upload closed captions, and indicate if the video is made for kids or not, among other options.

Add video elements such as cards and an end screen that shows viewers related videos to promote related content, websites, and calls to action.

The following are your four Visibility choices:

Public:The video you upload will go live immediately. However, you can choose to premiere it to start a specific time and set a countdown so that your viewers can watch as they interact with others.

Unlisted: The video is live, but only those with the link to the video can watch. It won’t be shown in the search results immediately.

Private: Only you and those you choose to watch the video can view it.

Schedule: Allows you to set a specific date and time when the video will go live on YouTube.

Note: If you’re not ready to share the video with the world, set it to private or unlisted once you publish it. This gives you time to check that everything you want is in place before you share it with your preferred audience or with the public and start promoting it.

Once your video has been uploaded to YouTube, you can change the permissions to control who can access the video, add video watermarks, and more.

How To Upload a Video To Youtube From a Phone

You can use the web browser or install the YouTube app on your Android phone or iPhone to upload a video to YouTube.

Go to chúng tôi tap the three dots menu at the upper right side of the screen.

Use the same steps described above to upload your video to YouTube from a web browser on your phone.

To upload a video to YouTube using the YouTube app, download and install the free YouTube app on your Android phone or iPhone, and then sign in to your Google account.

Tap the camcorder icon at the top, next to the search button.

Next, you’ll see two options: Record and Go Live. To upload the video, select it from the video files YouTube displays from your phone.

Fill out the details of the video such as title, description, location, and the visibility options: Public, Private, Unlisted, or Scheduled.

Next, select whether the video is made for kids or not, and if you want the video to be restricted to an adult audience so that it doesn’t show up in certain areas of YouTube.

How To Upload a Video To YouTube Using Third-Party Software

Some professional video editing tools like iMovie allow you to upload a video to YouTube directly from the software itself. Uploading a video to YouTube from video editing software helps you stay focused on your work by uploading your video from the same platform where you created it. 

If you prefer to export your video and upload to YouTube directly, you can still use the browser or YouTube app steps above.

Get Your Message Out To The World

YouTube makes it fast, free, and easy for content creators to upload their own videos and reach a large audience. We hope you were able to upload your video to YouTube using the steps above. Check out our Online Tech Tips channel on YouTube for more personal computing tips and tricks. 

How To Create Duotone Colors In Photoshop (Step By Step)

Creating a duotone image in Photoshop is an impressive way to make your photo pop. This design technique converts your image to only two colors of your choice. The result is a bold, striking picture highlighting the photo’s contrast.

There are two main methods to achieve the duotone effect when using Photoshop, and your method of choice should depend on your strengths. If you are comfortable using selections and masking techniques, choose option one. If you are more confident using gradients, then the second option is best for you.

When creating the duotone effect, a top tip is to use a high-contrast photo with a relatively simple background, as these images will produce the best result.

How To Create Duotone Colors In Photoshop

When adding a duotone effect to an image, you essentially add one color to the highlights and a second color to the shadows. Once you have selected your image and opened it in Photoshop, think about the colors you want to add and get started.

Step 1: Select The Highlights In The Image Using Channels

The first step is to isolate the highlights in the photo to add one color to those areas only. Using channels is a quick and super easy way to select the highlights (or shadows) in an image.

Open the Channels panel, which should be located in a panel tab next to the Layers panel. 

When using the RGB color mode, you will see four color channels: one with all the colors, then separate ones, each showing one color channel, Red, Green, and Blue. You must go through the individual color channels and decide which looks the best.

Your final duotone image will look like the color channel you select, with your two colors added to the shadows and highlights. So choose a channel that matches how you want the final result to look, which will be different for every image.

I like the Blue channel because it offers the most contrast for my picture, and I want a bold final result.

Once you’ve made the selection, you will see that the marching ants select only the highlights on the canvas.

Step 2: Add A Solid Fill Color To The Highlights

Now, you can use any method in the Color Picker to add your chosen color. You can add a HEX code, the RGB or CMYK values, or move the cursor around the color panel to find a color that works best. Since you are working with the highlights, you should choose a light color unless you want an inverted effect.

Move the color around to see a few different results.

Once you’ve selected your color, press OK to confirm your choice and close the Color Picker.

You have now added the color of your highlights to the photo.

Step 3: Add A Solid Fill Color To The Shadows

Adding a solid color to the shadows in the image is even easier since you have already isolated the highlights. Now you just need to add a color that only covers the shadows in the picture. To do this, select the background or image layer in the Layers panel.

The new fill layer will appear above the background layer but below the highlights layer. This ensures that the fill color only affects the shadows since the layer mask above has isolated the highlights.

You can now choose a color for the shadows in the Color Picker. Remember, a darker color works best since you are adding to the shadows.

You have now successfully created a duotone effect on your photo.

Step 4: Adjust The Colors As Needed

Since the process is entirely non-destructive, and your background layer is still intact, you can add any other edits you need and change the colors at any time. 

You can do this as many times as you need to find the perfect color combination for your image.

Using Gradient Maps To Create The Duotone Effect

The second method to create a duotone effect on a photo is using a Gradient Map adjustment layer. This method is even simpler than the previous method and offers a similar amount of control over the final result.

Step 1: Add A Gradient Map Adjustment Layer

Once your image is open in Photoshop, add a Gradient Map adjustment layer by opening the Adjustments panel and selecting the Gradient Map icon, which is the last icon in the list.

Once the Gradient Map is added to the image, the colors on the canvas become the two gradient colors. The colors and gradients added depend on the previous settings used when adding gradients to your projects. You can see the gradient settings in the Properties panel. 

In my case, a black-to-white gradient was added to the image. This shows how the duotone will look, and all that’s left is for me to change the colors. If you don’t have a black-to-white gradient yet, that’s fine. You can change it in the next step.

Step 2: Open The Gradient Editor

The Gradient Editor window opens, allowing you to change all the gradient settings.

First, if your gradient doesn’t have two colors, you can change this to make selecting the two new colors easier. To change the gradient type, open the Basics tab in the gradient presets section and select the black-to-white gradient.

Now, you can move on to change the shadows and highlights colors.

Step 3: Select A Color For The Shadows

To select a color for the shadows, you need to change the black color in the gradient, or if you don’t have a black-to-white gradient, you will change whatever color is on the left of the gradient bar.

Your gradient has the new color for the shadows added to the bar.

Step 4: Select A Color For The Highlights

You can now add the highlights color by repeating the above step using the color stop on the far right of the gradient bar.

You have successfully created a duotone color effect using a Gradient map on your image. 

This process is also non-destructive, as the gradient map is automatically added to a separate layer in the Layers panel.

You can change the colors anytime by selecting the Gradient map layer and opening the Gradient Editor in the Properties panel. Play around with the colors until you find the right combination for your photo.

With each of these methods, you can create the duotone effect in a way that suits your workflow. I personally prefer the simplicity of the Gradient Maps, but if you aren’t comfortable working with gradients, the first option using channels, will be right up your alley!

Part 13: Step By Step Guide To Master Nlp – Regular Expressions

This article was published as a part of the Data Science Blogathon

Introduction

This article is part of an ongoing blog series on Natural Language Processing (NLP). From this article, we will start our discussion on Regular Expressions. When a data scientist comes across a text processing problem whether it is searching for titles in names or dates of birth in a dataset, regular expressions rear their ugly head very frequently.

They form part of the basic techniques in NLP and learning them will make you a more efficient programmer. Therefore, Regular Expression is one of the key concepts of Natural Language Processing that every NLP expert should be proficient in.

This is part-13 of the blog series on the Step by Step Guide to Natural Language Processing.

 

Table of Contents

1. What are Regular Expressions?

2. How Do Regular Expressions Work?

3. What are the Properties of Regular Expressions?

4. How can Regular Expressions be used in NLP?

5. The concept of Raw string in Regular Expressions

6. Common Regex Functions used in NLP

7. Basics in Regular Expressions

8. What are Anchors?

9. What are Quantifiers?

10. Whitespace, Pipe Operator and Wildcard Character

11. Escaping Special Characters

12. Character Sets and Meta Sequences

What are Regular Expressions?

Regular expressions or RegEx is defined as a sequence of characters that are mainly used to find or replace patterns present in the text. In simple words, we can say that a regular expression is a set of characters or a pattern that is used to find substrings in a given string.

A regular expression (RE) is a language for specifying text search strings. It helps us to match or extract other strings or sets of strings, with the help of a specialized syntax present in a pattern.

For Example, extracting all hashtags from a tweet, getting email iD or phone numbers, etc from large unstructured text content.

Sometimes, we want to identify the different components of an email address.

 Image Source: Google Images

Simply put, a regular expression is defined as an ”instruction” that is given to a function on what and how to match, search or replace a set of strings.

Regular Expressions are used in various tasks such as,

Data pre-processing,

Rule-based information Mining systems,

Pattern Matching,

Text feature Engineering,

Web scraping,

Data Extraction, etc.

How do Regular Expressions Work?

Let’s understand the working of Regular expressions with the help of an example:

Consider the following list of some students of a School,

Names: Sunil, Shyam, Ankit, Surjeet, Sumit, Subhi, Surbhi, Siddharth, Sujan

And our goal is to select only those names from the above list which match a certain pattern such as something like this S u _ _ _

The names having the first two letters as S and u, followed by only three positions that can be taken up by any of the letters present in the dictionary. What do you think, which names from the above list fit this criterion?

Extracted Names: Sunil, Sumit, Sujan

What exactly we have done here is that we have a pattern and a list of student names and we have to find the name that matches the given pattern. That’s exactly how regular expressions work.

In RegEx, we have different types of patterns to recognize different strings of characters.

Properties of Regular Expressions 

Some of the important properties of Regular Expressions are as follows:

1. The Regular Expression language is formalized by an American Mathematician named Stephen Cole Kleene.

2. Regular Expression(RE) is a formula in a special language, which can be used for specifying simple classes of strings, a sequence of symbols. In simple words, we can say that Regular Expression is an algebraic notation for characterizing a set of strings.

3. Regular expression requires two things, one is the pattern that we want to search and the other is a corpus of text or a string from which we need to search the pattern.

Mathematically, we can define the concept of Regular Expression in the following manner:

1. ε is a Regular Expression, which indicates that the language is having an empty string.

2. φ is a Regular Expression which denotes that it is an empty language.

3. If X and Y are Regular Expressions, then the following expressions are also regular.

X, Y

X.Y(Concatenation of XY)

X+Y (Union of X and Y)

X*, Y* (Kleen Closure of X and Y)

4. If a string is derived from the above rules then that would also be a regular expression.

 

How can Regular Expressions be used in NLP?

In NLP, we can use Regular expressions at many places such as,

1. To Validate data fields.

For Example,  dates, email address, URLs, abbreviations, etc.

2. To Filter a particular text from the whole corpus.

For Example, spam, disallowed websites, etc.

3. To Identify particular strings in a text.

For Example, token boundaries

4. To convert the output of one processing component into the format required for a second component.

The concept of Raw String in Regular Expressions

Now let’s discuss a crucial concept which you must know while studying Regular Expressions. On the basis of your prior knowledge of Python Programming language, you might know that Python raw string treats backslash() as a literal character.

To understand this thing, let’s look at the following example:

After seeing the output, you can observe that n has moved the text after it to a new line. Here “nayan” has become “ayan” and n disappeared from the path. This is not what we want.

So, to resolve this issue, now we use the “r” expression to create a raw string:

Again after seeing the output, we have observed that now the entire path has printed out here by simply using “r” in front of the path.

Therefore, It is always recommended to use raw string instead of normal string while dealing with Regular expressions.

Common Regex Functions used in NLP

To work with Regular Expressions, Python has a built-in module known as “re”. Some common functions from this module are as follows:

re.search()

re.match()

re.sub()

re.findall()

Let us look at each function with the help of an example:

re. search( )

This function helps us to detect whether the given regular expression pattern is present in the given input string. It matches the first occurrence of a pattern in the entire string and not just at the beginning. It returns a Regex Object if the pattern is found in the string, else it returns a None object.

Syntax: re.search(patterns, string)

Within search functions, we can use different flags to perform specific operations. For Example,

‘re.I’ — to ignore the case (either uppercase or lowercase) of the text 're.M' — enables to search the string in multiple lines

In the following example, we search for the pattern “founder” in a given string

re.match( )

This function will only match the string if the pattern is present at the very start of the string.

Syntax: re.match(patterns, string)

In the following example, we match a word at the beginning of the string:

Here Pattern = ‘Analytics’ and String = ‘Analytics Vidhya is the largest data Scientists community’. Since the required pattern is present at the beginning of the string we got the matching Object as an output. And we know that the output of the re.match is an object, so to get the matched expression, we will use the group() function of the match object.

As we can observe that we have got our required output using the group() function. Now let us have a look at the other example which presents the second case:

Here as you can notice, our pattern(Scientists) is not present at the beginning of the string, hence we got None as our output.

re.sub( )

This function is used to substitute a substring with another substring.

Syntax: re.sub(patterns, Substitute, Input text)

In the following example, we replace xxx and yyy with abc in the given string:

re.findall( )

This function will return all the occurrences of the pattern from the string. I would recommend you to always use re.findall(). It can work like both re.search() and re.match(). Therefore, the result of the findall() function is a list of all the matches

Syntax: re.findall(patterns, string)   Basics in Regular Expressions

Let’s now discuss some of the basics used in Regular Expressions:

Brackets ([ ])

They are used to specify a disjunction of characters.

For Examples,

/[cC]hirag/ → Chirag or chirag /[xyz]/ → ‘x’, ‘y’, or ‘z’ /[1234567890]/ → any digit

Here slashes represent the start and end of a particular expression.

Dash (-)

They are used to specify a range.

For Examples,

/[A-Z]/ → matches an uppercase letter /[a-z]/ → matches a lowercase letter /[0–9]/ → matches a single digit Caret (^)

They can be used for negation or just to mean ^.

For Examples,

/[ˆa-z]/ → not an lowercase letter /[ˆCc]/ → neither ‘C’ nor ‘c’ /[ˆ.]/ → not a period /[cˆ]/ → either ‘c’ or ‘ˆ’ /xˆy/ → the pattern ‘xˆy’ Question mark (?)

It marks the optionality of the previous expression.

For Examples,

/maths?/ → math or maths /colou?r/ → color or colour Period (.)

Used to specify any character between two expressions.

For Examples,

/beg.n/ → Match any character between which fits between beg and n such as begin, begun

What are Anchors?

These are special characters that help us to perform string operations either at the beginning or at the end of text input. They are used to assert something about the string or the matching process. Generally, they are not used in a specific word or character but used while we are dealing with more general queries.

Caret character ‘^’

It specifies the start of the string. For a string to match the pattern, the character followed by the ‘^’ in the pattern should be the first character of the string.

Dollar character ‘$’

It specifies the end of the string. For a string to match the pattern, the character that precedes the ‘$’ in the pattern should be the last character in the string.

For Examples,

^The: Matches a string that starts with ‘The’ end$: Matches a string that ends with ‘end’ ^The end$’: Exact string match (starts and ends with ‘The end’) roar: Matches a string that has the text roar in it.   What are Quantifiers?

Some common Quantifiers are: ( *, +, ? and { } )

They allow us to mention and control over how many times a specific character(s) pattern should occur in the given text.

Image Source: Google Images

For Example, Let’s in a given data, we have variations of the word ‘Program’ such as ‘Program’, ‘Programmed’, ‘Programmer’. Our goal is to find only those words where one or more occurrences of ‘e’ appearing in the word ‘Program’. So, to achieve our goal, we can use any of the following quantifiers to indicate the presence of a particular character.

Let’s discuss all the quantifiers one by one:

‘?’

This quantifier matches the preceding character either zero or one time. Generally, It is used to mark the optional presence of a character.

‘*’

This quantifier is used to mark the presence of the preceding character either zero or more times.

‘+’

This quantifier matches the preceding character either one or more times. That means for the pattern to match the string, the preceding character has to be present at least once.

{m,n} quantifier

There are four variants of {m, n} quantifier. Let’s discuss each of them:

{m, n}

This quantifier matches the preceding character from ‘m’ number of times to ’n’ number of times.

{m, }

This quantifier matches the preceding character from ‘m’ number of times infinite times, therefore, there is no upper limit on the occurrence of the preceding character.

{, n}

This quantifier matches the preceding character from zero to ’n’ number of times, therefore, the upper limit is fixed for the occurrence of the preceding character.

{n}

This quantifier matches if the preceding character occurs exactly ’n’ number of times.

Each of the earlier mentioned quantifiers can be written in the form of {m,n} quantifier in the following way:

‘?’ is equivalent to zero or once, or {0, 1}

‘*’ is equivalent to zero or more times, or {0, }

‘+’ is equivalent to one or more times, or {1, }

For Examples,

abc*: matches a string that has 'ab' followed by zero or more 'c'. abc+: matches 'ab' followed by one or more 'c' abc?: matches 'ab' followed by zero or one 'c' abc{2}: matches 'ab' followed by 2 'c' abc{2, }: matches 'ab' followed by 2 or more 'c' abc{2, 5}: matches 'ab' followed by 2 upto 5 'c' a(bc)*: matches 'a' followed by zero or more copies of the sequence 'bc'   Whitespace

A white space can include a single space, multiple spaces, tab space, or a newline character (also known as a vertical space). It will match the corresponding spaces in the string.

For Examples,

‘ +’, i.e. a space followed by a plus sign will match one or more spaces. ‘Chirag Goyal’ will allow you to look for the name ‘Chirag Goyal’ in any given string.   Pipe Operator

The above pattern will match both the strings — ‘played’ and ‘walked’.

Therefore, the pipe operator tells us about the place inside the parentheses that can be either of the strings or the characters.

Wildcard Character

The ‘.’ (dot) character is also known as the wildcard character. It acts as a placeholder and can match any of the characters.

For Example, if a string starts with three characters, followed by two 0s and three 1s, followed by any four characters. Then, the valid strings that follow the above condition can be

cgh00111opqk, kgh00111pksr, etc.

The pattern that satisfies this kind of condition would be ‘.{3}0{2}1{3}.{4}’

You can also use ‘….00111..’ where the dot acts as a placeholder which means anything can sit in the place of the dot.

Escaping Special Characters

The characters which we discussed above in quantifiers such as ‘?’, ‘*’, ‘+’, ‘(‘, ‘)’, ‘{‘, etc. can also appear in the input text. So, In such cases to extract these specific characters, we have to use the escape sequences. The escape sequence, represented by a backslash ‘’, is used to escape the special meaning of the special characters.

*

It  is used to escape the star

.

It is used to escape the dot

+ 

It is used to escape the plus sign (to match a ‘+’ sign)

? 

It  is used to escape the question mark(to match a question mark)

The ‘’ itself is a special character, and to match the ‘’ character, we have to use the pattern ‘’ to escape the backslash.

Character Sets

1. Character sets provide a lot more flexibility than just typing a wildcard or the literal characters. These are groups of characters specified inside square brackets.

2. Character sets can be specified with or without the help of a quantifier.

3. When no quantifier succeeds the character set, it matches only one character and the match is successful only if the character in the string is one of the characters present inside the character set.

For Examples,

Example-1: The pattern ‘[a-z]ed’ will match strings such as ‘ted’, ‘bed’, ‘red’ and so on because the first character of each string — ‘t’, ‘b’ and ‘r’ — is present inside the range of the character set.

Example-2: When we use a character set with a quantifier, such as ‘[a-z]+ed’, it will match only those words that end with ‘ed’ like ‘watched’, ‘baked’, ‘jammed’, ‘educated’, and so on.

From the above examples, we have observed that when a quantifier is present inside the character set, then it loses its special meaning and treated as a normal character.

Let’s discuss the two use-cases of ‘^’ :

Outside a character set: works as an anchor

Inside a character set: works as a complement operator, i.e. matches any character other than the ones mentioned inside the character set.

For Example, The pattern [0–9] matches any single-digit number but on the contrary, the pattern ‘[^ 0-9]’ matches any single digit character that is not a digit.

 

Meta Sequences

Basically, Meta Sequences are a shorthand way to write commonly used character sets in the form of regular expressions. The commonly used meta-sequences are as follows:

Image Source: Google Images

We can use meta-sequences in the following two different ways:

Use them without the square brackets.

For Example, the pattern ‘w+’ will match any alphanumeric character.

Use them inside the square brackets.

For Example, the pattern ‘[w]+’ is the same as ‘w+’.

This ends our Part-13 of the Blog Series on Natural Language Processing! Other Blog Posts by Me

You can also check my previous blog posts.

Previous Data Science Blog posts.

LinkedIn

Here is my Linkedin profile in case you want to connect with me. I’ll be happy to be connected with you.

Email

For any queries, you can mail me on Gmail.

End Notes

Thanks for reading!

The media shown in this article are not owned by Analytics Vidhya and are used at the Author’s discretion.

Related

How To Remove Glare From Glasses In Photoshop (Step By Step)

Photographing a subject who is wearing glasses is difficult, especially for beginners. While there are a few tricks to avoid capturing the glare, such as tilting the glasses slightly, mistakes happen. So whether you photographed a subject and caught the glare in their glasses or you’re a graphic designer and given a photograph like this, here is how to remove glare from glasses in Photoshop.

When faced with a picture that has a glare on the person’s glasses, you face two issues. Firstly, the glare usually turns a different color, such as a green or blue tint. Secondly, the area that contains the glare is lighter than the surrounding areas. Luckily, you can fix both of these problems using the following editing techniques.

How To Remove Glare From Glasses In Photoshop

Removing glare from glasses is slightly different for each image. Sometimes you may only need to correct the color in the glasses. Other times, you’ll also need to remove the reflection from the glasses. Here I detail steps to fix the color, remove the reflection, and touch up any lines left behind from the reflection. Below is the example image I’ll work with today.

Step 1: Open Your Image And Add A New Layer

Once your image is open, you need to add a new layer. You will be adding the correct color onto this layer in the tinted areas, so name the layer accordingly to keep the Layers panel organized.

Step 2: Change The Blend Mode To Color And Select The Brush Tool (B)

Change the Blend Mode of the new layer to Color. This step lets you correct the color where the glare has added different colors, such as white, blue, or green. Changing the blend mode keeps the luminance and saturation the same and only changes the color.

To change the Blend Mode, select the drop-down menu in the Layers panel and select Color.

Then select the Brush Tool (B) from the Toolbar. 

Next, open the Brush Preset Picker in the Options bar and choose the Soft Round brush.

Leave the other settings in the Options bar as the default settings, such as Opacity and Flow, at 100%.

Step 3: Sample Colors And Brush Out The Colored Tint

Ensure that the new layer is still active and zoom into the image to get a better view of the lens glare. Zoom in by pressing Control + + (Win) or Command + + (Mac) as many times as needed.

For larger areas, you can increase the Brush Size by pressing ]. Then decrease the brush size using [ to paint smaller areas.

Keep sampling areas close to the new areas to be painted over. Then paint over the areas to correct the color. 

Since the areas covered by the glare are lighter than the rest, you won’t be able to correct the color at this point entirely, but I will show you how to fix this later.

Fixing the color takes a lot of practice, especially when the tint is blue or green. Keep trying, and don’t worry if you don’t get it entirely right, straight away. You can always continue fixing the color later in the process. However, with practice and patience, you can correct color even when the tint is more prominent, as in the example below.

Before After

Step 4: Select The Glare Area Using The Polygonal Lasso Tool (L) Step 5: Darken The Glare Using Levels Adjustment Layers

Once the selection is complete around the glare, you can add a selective adjustment layer to darken the selected area only. This adjustment enables you to match the lighter glare area with the rest of the image.

The Properties panel appears, where you can adjust the levels of your selection. The adjustments you make here will be different for your image based on how light or dark the glare is and how dark or light the rest of your photo is.

In the Levels adjustment panel, the toggle on the left controls the shadows, the middle toggle controls the midtones, and the toggle on the right controls the highlights.

In my case, I moved the shadows and midtones to the right to darken them and adjusted the highlights to the left to darken the highlights.

Adjust the toggles until you get the area as close to the rest of the subject’s face as possible. If you notice the color you fixed isn’t right, that’s fine. We’ll go back and fix it shortly.

Step 6: Add A Gaussian Blur To The Selections

When the Gaussian Blur dialog box opens, adjust the Radius amount to add blur to the area. Check Preview to see the changes on your image as you move the Radius slider. Don’t add too much blur here. Try to stay around 1 or 2 pixels.

The color is looking better at this stage, but there are still lines on the edges where the glare was. I will show you how to fix those lines soon.

Step 7: Repeat Steps 5 and 6 For Any Other Glare Areas

You can now repeat the last two steps for the other eye. It’s also necessary to repeat these steps if you need to correct other smaller glare pieces.

To recap, select the Polygonal Lasso Tool (L) or your selection tool of choice.

Add a Levels Adjustment layer by selecting the icon in the Adjustments panel. Place the new layer below the Color Correction layer.

Use the toggles in the Properties panel to darken the glare area. 

Repeat this for any other areas with a lot of lens glare. You don’t have to do this for more minor specks of lens glare, as we can fix this up in the next step.

Step 8: Use The Spot Healing Brush Tool (J) To Remove Visible Glare Lines

To fix up the visible lines that mark where the glare was on the glasses, you can use the Healing Brush Tool or the Spot Healing Brush Tool. If you want to control where the new pixels are sampled, use the Healing Brush Tool.

In my case, the areas are relatively simple, and Photoshop’s AI should be able to fix the area correctly. Select the Spot Healing Brush Tool (J) from the fly-out menu.

In the Options bar, ensure that the Mode is set to Normal, Type is set to Content-Aware, and Sample All Layers is checked. It’s essential to have Sample All Layers active as this allows the brush to sample pixels from the background layer to fix.

Now, brush over the areas where the visible line is. Create small brush strokes to prevent Photoshop from over-fixing the area and causing unwanted results.

Continue brushing small strokes around the area until the lines aren’t visible anymore.

Then move on to the other eye and repeat the process.

If you have smaller areas of lens glare that you didn’t touch up with the previous steps, you can use the Healing Brush Tool on these areas to remove the lighter colors.

Once you have fixed up those areas, zoom out of the image using Control + – (Win) or Command + – (Mac) to see how the image looks.

Step 9: Analyze The Image And Repeat Any Steps As Needed

The image should look much better at this point, but it doesn’t have to be perfect yet. In my case, I’m not too happy with the color of one eye. Whether you notice a problem with the Levels or the color, you can move back to that layer and continue editing to get it how you’d like.

I’m going to move back to my Color Correction layer and repeat steps 2 and 3 to get a more realistic color near the corner of the eye.

Once you have finished touching up any problem areas, you have successfully removed lens glare from your image.

Before After

To learn more about removing unwanted things from images in Photoshop, check out these 4 best tools for removing anything in Photoshop!

How To Add Texture To Text In Photoshop (Step By Step)

Text is often a tricky element for graphic designers to work with because flat text makes the design look bland. Whether for a logo or layout design, customizing text can elevate the design. There are many ways you can edit text, and one of my favorites is to add texture to text in Photoshop.

When adding texture to text, the options are almost endless. You can choose from various fonts already in Photoshop or download fonts online. Then, you can select any type of texture, whether watercolor, metallic, fire, rust or anything else. Lastly, you can add personal touches to the design, such as adding brush strokes to extend the effect.

How To Add Texture To Text In Photoshop

As with most processes in Photoshop, you can tweak settings and techniques to add your own creativity to the project. Use these steps as a general guide but try the effect with different textures, fonts, and brushes to take this process to the next level.

Step 1: Add Text To The Canvas Using The Type Tool (T)

Once you have created a document the size you need, add your text to the canvas. Select the Type Tool from the Toolbar or press T to add text.

Your text box will likely be filled with Placeholder text to show you the font size and type.

Use the settings in the Options bar to customize the text. You can choose a different font, I recommend you find a bold font, so there is plenty of space for the texture to fit and be visible. 

You can then adjust the font size. Don’t worry about the font color, as the texture will cover the color anyway.

You can then type in your custom text and position the text box on the canvas.

You can edit various elements of the text in this panel, such as the Kerning, Leading, and Tracking. I adjusted the Leading to alter the space between the two text lines and the Tracking to widen the gap between each character.

Customize your text as you’d like to at this stage. This is how my text looks after the various adjustments.

Step 2: Add A Texture Layer Over The Text Using A Clipping Mask

The next step is to add a texture image over the text layer. First, you need to choose the type of texture you want. You can find several free texture images from various sites, such as Unsplash or Pexels.

You can also create your own texture layer in Photoshop in a separate document using different brushes.

The texture image must be on top of the text layer.

You must ensure the texture covers the text on the canvas. If the image layer is smaller than the text, resize it by pressing Control + T (Win) or Command + T (Mac) to open the Free Transform function, then use the corner anchor points to drag and resize the image layer. Press Enter to accept the new size.

The texture is now clipped to the text layer, meaning it’s only shown where the text is.

Step 3: Adjust The Texture Image And Text

You can still edit the text and the overlay as needed at this stage. For instance, if the texture isn’t sitting how you want it inside the text, you can move the layer, so it fills the text better. 

You can use the same transform function as before to resize the texture. You can also use the Type Tool to edit the text as you did at the start or by typing new text in. 

Add any adjustments you want at this point because if you are moving to the next step, you won’t be able to edit the text anymore. I recommend you save a copy of the text layer if you think you may need to edit it later.

If you are happy with the texture and the text, you can leave it as it is. However, if you want to add more to the text, follow the next steps to add or remove bits from the text.

Step 4: Rasterize The Text Layer

To continue the edits, you need to Rasterize the text layer, which means the only modifications you can make to the text after this point are moving or resizing the text.

Next, resize or reposition the text if you’d like. You want to have your text in place before adding the brush strokes.

Step 5: Find And Select A Matching Brush Type

Now it’s time to choose a brush preset to use on your text. I recommend you find a brush that matches the texture you use. For instance, if you added a rust texture, find a grungy brush or, in my case, a watercolor brush.

You can look for more brushes through Adobe to find one that matches your project.

To find more brushes, select the Brush Tool in the Toolbar or press B.

Then, back in Photoshop, open the Brush preset settings again and select Import Brushes this time.

Step 6: Add Brush Strokes Around The Text

To use the new brush(es) on your project, find the brush set in the Brush Picker and open the tab to view the available brushes.

Avoid brushes with an eraser icon in the top right, and choose one with a brush icon instead.

This is where you can get creative with your text by adding various brush effects. First, select a brush and keep the text layer active.

Then, select a different brush and add a few strokes if you’d like. Remember to adjust the brush size and opacity as you go for more dynamic effects.

Step 7: Remove Parts Of The Text Using A Layer Mask

Instead of using two brushes to add more to the text, you can use one brush to add more texture and then remove parts of the text for a different effect. There are two ways you can remove bits of the text.

Start by adding brush strokes to the text, as shown in the previous section.

Option 1: Add A New Layer

Then, use any brush and set the foreground color to white (or whatever the background color of the canvas is). 

Now, use any brush from the set and paint over areas you want to take away from the text. You can use the same brush or a different one. You can also play around with the Brush Opacity to partially remove parts of the text.

Option 2: Add A Layer Mask

Alternatively, you can use a layer mask to remove parts of the text instead of adding a new layer.

The layer mask is white when you add it, and this reveals everything on the layer. To hide everything, ensure the mask is selected, shown by a white border around it, then invert the mask by pressing Control + I (Win) or Command + I (Mac). 

You will notice the layer mask turns completely black, and your canvas is now blank.

Now, you can choose one of the new brushes and set the foreground color to white.

Ensure the opacity is relatively high and the brush blend mode is set the Normal. Some brushes automatically have a different blend mode.

Then, brush over areas of the text on the canvas where you want the text to be visible. You can use a large brush and swipe over the entire text or add random splotches. You now have a dynamic and creative texture effect on your text.

These steps are only a basic guide on what you can do when adding texture to text. You can alter these techniques to create a unique text layout for your project, so don’t be shy to play around and change different settings to see what you can make.

Update the detailed information about A Step By Step With Detailed on the Daihoichemgio.com website. We hope the article's content will meet your needs, and we will regularly update the information to provide you with the fastest and most accurate information. Have a great day!