# Regex for repeat words

**URL:** https://community.glideapps.com/t/regex-for-repeat-words/59692
**Category:** Ask for Help
**Created:** [March 26, 2023, 2:19am UTC](https://community.glideapps.com/t/regex-for-repeat-words/59692 "2023-03-26T02:19:07Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Himaladin](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/himaladin/32/71023_2.png) [@Himaladin](https://community.glideapps.com/u/Himaladin)
#### Post date: [March 26, 2023, 2:19am UTC](https://community.glideapps.com/t/regex-for-repeat-words/59692/1 "2023-03-26T02:19:07Z")

</div>

I’m having trouble validating by using regex. An example of a word that I want to validate is similar repeated words separated by a ‘-’ sign without spaces, where the first word of the repeated word is a capital letter followed by a lowercase letter, while the second word is all lowercase.

Example:  
Dunia Anak-anak Masa Kini. //true  
Dunia Ibu-Ibu Masa Kini. //false

Would really appreciate it if there is a way of solving this.

---

<div class="post-metadata">

### Author: ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)
#### Post date: [March 26, 2023, 2:52am UTC](https://community.glideapps.com/t/regex-for-repeat-words/59692/2 "2023-03-26T02:52:17Z")

</div>

Confusing… how is this written in columns? And what is the flow?

---

<div class="post-metadata">

### Author: ![Himaladin](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/himaladin/32/71023_2.png) [@Himaladin](https://community.glideapps.com/u/Himaladin)
#### Post date: [March 26, 2023, 3:47am UTC](https://community.glideapps.com/t/regex-for-repeat-words/59692/3 "2023-03-26T03:47:37Z")

</div>

By using the “Check Text Matches” column and it didn’t work with various regex.  
Success is only for the word “Ibu-Ibu” with a capital letter at the beginning of both words to be judged true.

---

<div class="post-metadata">

### Author: ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)
#### Post date: [March 26, 2023, 4:09am UTC](https://community.glideapps.com/t/regex-for-repeat-words/59692/4 "2023-03-26T04:09:38Z")

</div>

Do you want to check if the first and second words, “Ibu” the first letter, are capitalized or the same? And do you have them in separate columns?

---

<div class="post-metadata">

### Author: ![Himaladin](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/himaladin/32/71023_2.png) [@Himaladin](https://community.glideapps.com/u/Himaladin)
#### Post date: [March 26, 2023, 4:17am UTC](https://community.glideapps.com/t/regex-for-repeat-words/59692/5 "2023-03-26T04:17:55Z")

</div>

Make sure the second word is similar to the first word and use lowercase.  
For the first word with a capital letter at the beginning followed by lowercase letters, it can be included or not included in the validation.

---

<div class="post-metadata">

### Author: ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)
#### Post date: [March 26, 2023, 4:20am UTC](https://community.glideapps.com/t/regex-for-repeat-words/59692/6 "2023-03-26T04:20:38Z")

</div>

I have a hard time understanding you… Do you want to check if the first is the same as the second when translated to lowercase?

Home is home?  
HOmE is hOmE?

or only the first letters can be altered?

---

<div class="post-metadata">

### Author: ![Himaladin](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/himaladin/32/71023_2.png) [@Himaladin](https://community.glideapps.com/u/Himaladin)
#### Post date: [March 26, 2023, 4:25am UTC](https://community.glideapps.com/t/regex-for-repeat-words/59692/7 "2023-03-26T04:25:36Z")

</div>

In Indonesian, we know the existence of repeated words. The repeated word will be connected with a ‘-’ sign. The terms for writing the rewards are as I demonstrated above. What is needed is a validation of the use of capital letters/lowercase letters in the correctness of writing.  
Maybe in English: Home-home //true and HOmE-hOmE //false (The second word is not all lowercase)

---

<div class="post-metadata">

### Author: ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)
#### Post date: [March 26, 2023, 4:27am UTC](https://community.glideapps.com/t/regex-for-repeat-words/59692/8 "2023-03-26T04:27:18Z")

</div>

I have to give up. I do not understand what you are trying to say.

---

<div class="post-metadata">

### Author: ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)
#### Post date: [March 26, 2023, 4:29am UTC](https://community.glideapps.com/t/regex-for-repeat-words/59692/9 "2023-03-26T04:29:33Z")

</div>

Ok… now you start making sense 😉

Ok, so it is only true when the second word is all lowercase and the same word as the first one?

Do you have these words in separate columns?  
Can you show a screenshot of the data sheet?

---

<div class="post-metadata">

### Author: ![Himaladin](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/himaladin/32/71023_2.png) [@Himaladin](https://community.glideapps.com/u/Himaladin)
#### Post date: [March 26, 2023, 4:31am UTC](https://community.glideapps.com/t/regex-for-repeat-words/59692/10 "2023-03-26T04:31:50Z")

</div>

No, it’s a title that the user inputs in one sentence and one row in one column.

---

<div class="post-metadata">

### Author: ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)
#### Post date: [March 26, 2023, 4:33am UTC](https://community.glideapps.com/t/regex-for-repeat-words/59692/11 "2023-03-26T04:33:13Z")

</div>

oh… so someone is entering this… this will be hard to break down… the only word in that entry with “-” is the one you looking for? or there might be more “-” in that entry?

---

<div class="post-metadata">

### Author: ![Himaladin](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/himaladin/32/71023_2.png) [@Himaladin](https://community.glideapps.com/u/Himaladin)
#### Post date: [March 26, 2023, 4:33am UTC](https://community.glideapps.com/t/regex-for-repeat-words/59692/12 "2023-03-26T04:33:49Z")

</div>

I know, so asking. 😁 The repeated words are in a sentence that can be long.

---

<div class="post-metadata">

### Author: ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)
#### Post date: [March 26, 2023, 4:37am UTC](https://community.glideapps.com/t/regex-for-repeat-words/59692/13 "2023-03-26T04:37:40Z")

</div>

im asking if there will be more “-” in the sentence.  
if there is only one “-”, is not very complicated

---

<div class="post-metadata">

### Author: ![Himaladin](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/himaladin/32/71023_2.png) [@Himaladin](https://community.glideapps.com/u/Himaladin)
#### Post date: [March 26, 2023, 4:42am UTC](https://community.glideapps.com/t/regex-for-repeat-words/59692/14 "2023-03-26T04:42:23Z")

</div>

Maybe one or more. I can’t know what the user entered, as long as it’s in the ‘-’ sign, the second word must be lowercase.

I’ve achieved validation if both are capitalized, not lowercase in the second word.  
\b([A-Z][a-z]+)-\1\b

---

<div class="post-metadata">

### Author: ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)
#### Post date: [March 26, 2023, 4:46am UTC](https://community.glideapps.com/t/regex-for-repeat-words/59692/15 "2023-03-26T04:46:35Z")

</div>

if there are more “-”, then it will be a very complicated script… did you already extract all words with “-”?

---

<div class="post-metadata">

### Author: ![Himaladin](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/himaladin/32/71023_2.png) [@Himaladin](https://community.glideapps.com/u/Himaladin)
#### Post date: [March 26, 2023, 4:48am UTC](https://community.glideapps.com/t/regex-for-repeat-words/59692/16 "2023-03-26T04:48:45Z")

</div>

Consider only one first. Maybe I’ll use layered validation (if-then-else).

---

<div class="post-metadata">

### Author: ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)
#### Post date: [March 26, 2023, 4:50am UTC](https://community.glideapps.com/t/regex-for-repeat-words/59692/17 "2023-03-26T04:50:44Z")

</div>

What if someone uses “-” for another purpose in the sentence?

---

<div class="post-metadata">

### Author: ![Himaladin](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/himaladin/32/71023_2.png) [@Himaladin](https://community.glideapps.com/u/Himaladin)
#### Post date: [March 26, 2023, 4:52am UTC](https://community.glideapps.com/t/regex-for-repeat-words/59692/18 "2023-03-26T04:52:24Z")

</div>

Do you mean like this: Dunia Anak-anak dan Ibu-Ibu Masa Kini.  
Where one condition is true and the other is not?

---

<div class="post-metadata">

### Author: ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)
#### Post date: [March 26, 2023, 4:53am UTC](https://community.glideapps.com/t/regex-for-repeat-words/59692/19 "2023-03-26T04:53:44Z")

</div>

Ok…  
extract words with “-”  
split them by “-”  
convert the second one to lowercase  
check if the converted one is the same as not converted  
this is how you will know if the second one is all lowercase  
then convert the first one to lowercase and check if it is the same as the second converted one… this way, you will know if first and second are the exact words

---

<div class="post-metadata">

### Author: ![Himaladin](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/himaladin/32/71023_2.png) [@Himaladin](https://community.glideapps.com/u/Himaladin)
#### Post date: [March 26, 2023, 4:56am UTC](https://community.glideapps.com/t/regex-for-repeat-words/59692/20 "2023-03-26T04:56:26Z")

</div>

Another problem: how to extract words?  
Can all be put together with javascript + regex?

[Next page](https://community.glideapps.com/t/regex-for-repeat-words/59692.md?page=2)
