Regex for repeat words

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.

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

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

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

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.

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?

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.

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?

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)

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

Ok… now you start making sense :wink:

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?

1 Like

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

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?

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

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

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.

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

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

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

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

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

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