# New Regex/String Task

**URL:** <https://forum.xojo.com/t/new-regex-string-task/50200>\
**Category:** General\
**Created:** [September 10, 2019, 9:03pm UTC](https://forum.xojo.com/t/new-regex-string-task/50200 "2019-09-10T21:03:44Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin\_T](https://forum.xojo.com/letter_avatar_proxy/v4/letter/m/a88e57/32.png) [@Martin\_T](https://forum.xojo.com/u/Martin_T)\
**Post date:** [September 10, 2019, 9:03pm UTC](https://forum.xojo.com/t/new-regex-string-task/50200/1 "2019-09-10T21:03:44Z")

</div>

Hello,

I’m looking for a RegEx pattern again. It should search a Unicode string, no matter if with russian or arabic letters, for capital letters and then divide it. Only one string without spaces before or after is used as source.

Example: `Dim s As String = "helloWorldisACoolThing"`

To be split as in: “hello”, “Worldis”, “A”, “Cool”, “Thing”.

How can you do that? Any ideas?

---

<div class="post-metadata">

**Author:** ![Kem\_Tekinay](https://forum.xojo.com/user_avatar/forum.xojo.com/kem_tekinay/32/154_2.png) [@Kem\_Tekinay](https://forum.xojo.com/u/Kem_Tekinay)\
**Post date:** [September 10, 2019, 9:33pm UTC](https://forum.xojo.com/t/new-regex-string-task/50200/2 "2019-09-10T21:33:45Z")

</div>

Coming up…

---

<div class="post-metadata">

**Author:** ![Kem\_Tekinay](https://forum.xojo.com/user_avatar/forum.xojo.com/kem_tekinay/32/154_2.png) [@Kem\_Tekinay](https://forum.xojo.com/u/Kem_Tekinay)\
**Post date:** [September 10, 2019, 9:45pm UTC](https://forum.xojo.com/t/new-regex-string-task/50200/3 "2019-09-10T21:45:46Z")

</div>

```auto
(?:^|\\p{Lu})\\p{Ll}*
```

---

<div class="post-metadata">

**Author:** ![Kem\_Tekinay](https://forum.xojo.com/user_avatar/forum.xojo.com/kem_tekinay/32/154_2.png) [@Kem\_Tekinay](https://forum.xojo.com/u/Kem_Tekinay)\
**Post date:** [September 10, 2019, 9:46pm UTC](https://forum.xojo.com/t/new-regex-string-task/50200/4 "2019-09-10T21:46:56Z")

</div>

\p matches based on Unicode properties. {Ll} is lowercase letters, {Lu} is uppercase. If you have RegExRX, you can see the complete list of scripts and properties.

---

<div class="post-metadata">

**Author:** ![Martin\_T](https://forum.xojo.com/letter_avatar_proxy/v4/letter/m/a88e57/32.png) [@Martin\_T](https://forum.xojo.com/u/Martin_T)\
**Post date:** [September 10, 2019, 9:49pm UTC](https://forum.xojo.com/t/new-regex-string-task/50200/5 "2019-09-10T21:49:10Z")

</div>

> [@453575:@Kem Tekinay](#):
>
> code\p{Ll}\*[/code]

Looking good for my sample, but if I modify my source to “HhelloWorldisACoolThing” then the pattern doesn’t work correct. Same for “HHHhelloWorldisACoolThing”.

---

<div class="post-metadata">

**Author:** ![Kem\_Tekinay](https://forum.xojo.com/user_avatar/forum.xojo.com/kem_tekinay/32/154_2.png) [@Kem\_Tekinay](https://forum.xojo.com/u/Kem_Tekinay)\
**Post date:** [September 10, 2019, 9:51pm UTC](https://forum.xojo.com/t/new-regex-string-task/50200/6 "2019-09-10T21:51:02Z")

</div>

```auto
(?:^\\pL|\\p{Lu})\\p{Ll}*
```

---

<div class="post-metadata">

**Author:** ![Kem\_Tekinay](https://forum.xojo.com/user_avatar/forum.xojo.com/kem_tekinay/32/154_2.png) [@Kem\_Tekinay](https://forum.xojo.com/u/Kem_Tekinay)\
**Post date:** [September 10, 2019, 9:51pm UTC](https://forum.xojo.com/t/new-regex-string-task/50200/7 "2019-09-10T21:51:25Z")

</div>

At the start of a line, any letter will do.

---

<div class="post-metadata">

**Author:** ![Martin\_T](https://forum.xojo.com/letter_avatar_proxy/v4/letter/m/a88e57/32.png) [@Martin\_T](https://forum.xojo.com/u/Martin_T)\
**Post date:** [September 10, 2019, 9:53pm UTC](https://forum.xojo.com/t/new-regex-string-task/50200/8 "2019-09-10T21:53:24Z")

</div>

Great Kem, thank you so much. You should write a book about RegEx-Patterns :). BTW, do you think, this is the fastest Pattern we can get?

---

<div class="post-metadata">

**Author:** ![Kem\_Tekinay](https://forum.xojo.com/user_avatar/forum.xojo.com/kem_tekinay/32/154_2.png) [@Kem\_Tekinay](https://forum.xojo.com/u/Kem_Tekinay)\
**Post date:** [September 11, 2019, 3:38am UTC](https://forum.xojo.com/t/new-regex-string-task/50200/9 "2019-09-11T03:38:45Z")

</div>

Considering your requirements, I think so.

---

<div class="post-metadata">

**Author:** ![Martin\_T](https://forum.xojo.com/letter_avatar_proxy/v4/letter/m/a88e57/32.png) [@Martin\_T](https://forum.xojo.com/u/Martin_T)\
**Post date:** [September 11, 2019, 12:46pm UTC](https://forum.xojo.com/t/new-regex-string-task/50200/10 "2019-09-11T12:46:48Z")

</div>

Hi Kem,  
I have tested the pattern in detail once. Unfortunately it ignores punctuation marks within a string like dot, comma, semicolon, hyphen, underscore, Numbers etc. (e.g. `helloWorldisACoolThing1,;:^"&%`). What is missing in the pattern?

---

<div class="post-metadata">

**Author:** ![Kem\_Tekinay](https://forum.xojo.com/user_avatar/forum.xojo.com/kem_tekinay/32/154_2.png) [@Kem\_Tekinay](https://forum.xojo.com/u/Kem_Tekinay)\
**Post date:** [September 11, 2019, 12:51pm UTC](https://forum.xojo.com/t/new-regex-string-task/50200/11 "2019-09-11T12:51:02Z")

</div>

The pattern only looks for symbols that would be considered letters, and nothing else. If you only care about uppercase letters as a delimiter…

```auto
(?:^.|\\p{Lu})\\P{Lu}*
```

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [April 29, 2021, 4:05pm UTC](https://forum.xojo.com/t/new-regex-string-task/50200/12 "2021-04-29T16:05:13Z")

</div>


