0:00 Hi. So I'll be had a question and I answered his question about replacing the first word and I really thought, wow, this is really cool and useful for a lot of other uses.
0:11 So I wanted to, other than what he was doing. So I wanted to make a video for all members and share with you what, how to replace the first part.
0:19 So sometimes we have like keyword research and SEO, or we're doing like tagging or labeling of data or categorization. And we're like, we want to change a category, but we don't want to change like the whole phrase.
0:32 We want to change just a word. So here's like some weird examples. We have like, not a description, but like, like a title.
0:41 And we say like something like, hello, dining chair. It's just like a weird example. I know. And then we have like the goodbye dining chair and the like dinner table and we have like a functional table and maybe we want to like replace with word.
1:07 And we really want like maybe someone to come in here. Either we get this like programmatically, or we have like a road, like, Hey, we need to change this.
1:14 Like the first thing we need to change, like hello to high, we need to change goodbye to farewell. It's actually should be called the farewell of dining chair or it's a dinner.
1:23 It's not a dinner table. It's a funk. It's a breakfast table and functional table is actually called a big table, right?
1:35 Like we want to, we want to replace this entire first word and it's always going to be the first word in this particular use case.
1:43 So I thought it was a clever thing to show you how to do this. If we want to replace characters, was sort of saying in this question, I already know how to replace characters.
1:56 There's like rejects and regular expressions we can use, but I found sort of another way, a formula way to do this.
2:02 So here, look, let me show you so first off, how do we get the first word? How do we know?
2:07 Like, what is the first word? Well, we always know the first word because it, the first word always ends in a space.
2:12 So basically what we need to do is find or discover what is the first space. So what we do is we use equals spine.
2:20 We're searching for a, in quotes space and then text a search. We're going to search a two, and we're going to start at, see if there's zero one.
2:28 I always forget. So I just clicked out here, even optional. We don't even have to do it. So let's not do it for right now.
2:37 All right. It gives us the number six. And if we go down here, we see this is 8, 6, 7. This is 11.
2:43 This is the number of characters to get to that space. But what we want to do is we want to do something else with this, right?
2:55 We don't want to just find that number. We want to get the entire word out of there. So let's look at using the formula mid, your mid, and the string is a two as well.
3:08 And we're starting at a one and we're going to extract a length of this fight, whatever this was. If you know what we're doing already, you're going to find out that there is a middle error here, but we won't find that out until we actually try to replace the word.
3:23 So well, spoiler alert, spoiler. There is something we have to go back and figure out later, but I will show you what we're going to run into this problem.
3:34 So we're going to replace the text. We're gonna replace. Hello. We're going to replace a position. I think it's one length is going to be a finding as well.
3:46 So until the find same thing, space text to search a, to oh, we don't need that. And the new text is going to be B to write the column here.
3:59 Now, already you can tell, or maybe you might not be able to tell what's going on. It says, H I D there is no space here.
4:07 We want to preserve the space. So we actually have a little bit of an error here. And it's very hard to find, and this is one of my pet peeves and it's spaces, trailing spaces.
4:20 And so we have to actually do is go over to the spine. We do minus one. Now, if you notice, there is no change.
4:26 That is good because we have now deleted that space. Now, if we go to this fine, go minus one. And we now have our space back.
4:36 So now we've taken this replace find and used it to replace an entire word at the very first word, right?
4:48 Whatever the first word is, we've replaced it with what we want to do. And this is like really simple. Now that you've gone through this and we've looked at it, we had this little, extra little error.
4:59 They had come accommodate this negative one because of the space. But it turns out this is really useful for a lot of things.
5:10 SEO, keyword, matching keyword figuring out keywords, creating more keywords. A lot of ways you can use this. And if you find any more unique, interesting ways, you can use this.
5:21 If you even think of something, a comment down below below this video. And I think it'd be helpful for others to know what other use cases there are for this.
5:31 Thanks so much for watching.