# Extracting name from text

**URL:** https://community.fibery.io/t/extracting-name-from-text/5181
**Category:** Misc
**Created:** [September 20, 2023, 4:46am UTC](https://community.fibery.io/t/extracting-name-from-text/5181 "2023-09-20T04:46:32Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Minh\_Tri\_Do\_Hang](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/minh_tri_do_hang/32/6791_2.png) [@Minh\_Tri\_Do\_Hang](https://community.fibery.io/u/Minh_Tri_Do_Hang)
#### Post date: [September 20, 2023, 4:46am UTC](https://community.fibery.io/t/extracting-name-from-text/5181/1 "2023-09-20T04:46:32Z")

</div>

@Chr1sG I got some several name text field like this, which formula should i have to extract employee name only (name after 👩‍🌾 )  
🕙➕ - 👩‍🌾 Tuấn 18-Sep-2023  
🕙 - 👩‍🌾 Hạnh 19-Sep-2023  
🕢 - 👩‍🌾 Nhung 19-Sep-2023  
🕙 - 👩‍🌾 Huấn 19-Sep-2023  
🕙 - 👩‍🌾 Huy 19-Sep-2023  
🕙 - 👩‍🌾 Thuần 19-Sep-2023  
🕙 - 👩‍🌾 Tuấn - ⛔✔ 15:00 19-Sep-2023  
🕢 7:45 - 👩‍🌾 Hạnh 20-Sep-2023  
🕙🔄 - 👩‍🌾 Huấn ⇄ Nhung 20-Sep-2023  
🕙 - 👩‍🌾 Thuần Hoài Nguyễn - ⛔✔ 14:00 20-Sep-2023  
🕢 - 👩‍🌾 Huy An- ⛔ 20-Sep-2023  
🕢🔄 - 👩‍🌾 Nhung ⇄ Huấn 20-Sep-2023  
🕙 - 👩‍🌾 Tuấn - ⌛✔ 20:00 → 21:45 20-Sep-2023  
🕢🔄 - 👩‍🌾 Nhung ⇄ Huấn 20-Sep-2023

---

<div class="post-metadata">

### Author: ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)
#### Post date: [September 20, 2023, 6:25am UTC](https://community.fibery.io/t/extracting-name-from-text/5181/2 "2023-09-20T06:25:41Z")

</div>

I assume that you are talking about these lines being in a rich text field, right?  
If so, you would need to write an automation to get the rich text field contents and then use regex to pattern match.  
It looks rather complicated to me, since although the names are prefixed with the 👩‍🌾 emoji, it’s not obvious to me how to determine where a name has ended.  
For example, do you need to extract two names from this: `Nhung ⇄ Huấn`.

How is this data coming into Fibery? I wonder if it might be easier to preprocess the text in some way…

---

<div class="post-metadata">

### Author: ![Minh\_Tri\_Do\_Hang](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/minh_tri_do_hang/32/6791_2.png) [@Minh\_Tri\_Do\_Hang](https://community.fibery.io/u/Minh_Tri_Do_Hang)
#### Post date: [September 20, 2023, 7:03am UTC](https://community.fibery.io/t/extracting-name-from-text/5181/3 "2023-09-20T07:03:07Z")

</div>

That mean employee name swap shift to each other

Vào 13:35, T.4, 20 Th9, 2023 Chr1sG via Fibery Community \<[notifications@fibery.discoursemail.com](mailto:notifications@fibery.discoursemail.com)\> đã viết:

---

<div class="post-metadata">

### Author: ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)
#### Post date: [September 20, 2023, 7:14am UTC](https://community.fibery.io/t/extracting-name-from-text/5181/4 "2023-09-20T07:14:41Z")

</div>

Any comments to my other points?

---

<div class="post-metadata">

### Author: ![Minh\_Tri\_Do\_Hang](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/minh_tri_do_hang/32/6791_2.png) [@Minh\_Tri\_Do\_Hang](https://community.fibery.io/u/Minh_Tri_Do_Hang)
#### Post date: [September 20, 2023, 8:23am UTC](https://community.fibery.io/t/extracting-name-from-text/5181/5 "2023-09-20T08:23:34Z")

</div>

ah, seem I need to have more details about what I’m doing. Long time ago I have posted about tracking my employee shifts in fibery, and I feel it really hard to navigate direct in there, so I migrate the input stage in google calendar, and using emoji updating beyond on the change of original. Here’ s originial for each employee

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/4/496a9a022164b69416697f840aa6228680d459d5.png)

Each day when somethings changes like: sick leave, vacation off, swap shifts … I put some emoji on that to know what change with original  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/b/b43ef997cdac86ddc17364430a4cc65b55991671.png)

Consumed the emoji structure will be: {Shift}{Shift Kind}{Details} - {Employee} - {Absence or Overtime}{Details}  
Ex:  
🕢 - 👩‍🌾 Huy Thành Nguyễn- ⛔ : meaning shift 1 (7:30am), assigned for Employee Huy Thành Nguyễn but Absence with no reason  
🕢 7:45 - 👩‍🌾 Nguyễn Hạnh : meaning shift 1 (7:30am) and employee Hạnh assigned and also come late at 7:45  
🕢🔄 - 👩‍🌾 Nhung ⇄ Huấn: meaning orginal shift 's (10:00am) but Both employee agree to swap to each other: so Employee Nhung change from 10:00 to 7:30 shift and swap with Huấn Employee

I’m using 1 way google calendar sync to fibery, so when something update in google calendar, I can extract status for each type in fibery like Absence/ Overtime/ Come late/ Swap Shifts … So I need to extract the name field to specific fields: {People Assigned} | {Swap Status} | {Overtime Status} …

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/7/75a58d28a31b644e83837f97f66093161982e297.png)

Not only Employee Name, I also wanna extract Shift: 🕖🕢 , Status: ⛔🔄… to process in fibery… But feel hard to find the right formula to extract those, need advice from you @Chr1sG

---

<div class="post-metadata">

### Author: ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)
#### Post date: [September 20, 2023, 10:49am UTC](https://community.fibery.io/t/extracting-name-from-text/5181/6 "2023-09-20T10:49:39Z")

</div>

Well, it sounds like you would be best served by having several formula fields, each of which returns the relevant information, e.g.

`If(Find(Name, "🕙") > 0, "morning shift", "afternoon shift")`  
returns a text string for the shift name

`Find(Name, "⛔") > 0`  
returns true if the person didn’t show up

`Find(Name, "🔁") > 0`  
returns true if there was a swap

etc.

Extracting the names is a little more complicated, since it seems like the name can be followed by a number, a hyphen or a ⇄ symbol.

So I would suggest using a regex formula to find the first name:

```auto
ReplaceRegex(
  Right(Name, Length(Name) - Find(Name, "👩‍🌾") - 2),
  If(Find(Name, "🔁") > 0, "(.*)( [⇄])(.*)", "(.*)( [0-9-])(.*)"),
  "\1"
)

```

then you can use another similar formula to find the second name, in the case there was a swap, e.g.

```auto
If(
  Find(Name, "🔁") > 0,
  ReplaceRegex(
    Right(Name, Length(Name) - Find(Name, "⇄") - 1),
    "(.*)( [0-9-])(.*)",
    "\1"
  ),
  ""
)

```

For any of the formulas that return a name, you might want to wrap them in `Trim()` to remove any leading or trailing spaces, just in case, e.g.

```auto
Trim(
  If(
    Find(Name, "🔁") > 0,
    ReplaceRegex(
      Right(Name, Length(Name) - Find(Name, "⇄") - 1),
      "(.*)( [0-9-])(.*)",
      "\1"
    ),
    ""
  )
)

```

---

<div class="post-metadata">

### Author: ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)
#### Post date: [September 20, 2023, 11:06am UTC](https://community.fibery.io/t/extracting-name-from-text/5181/7 "2023-09-20T11:06:56Z")

</div>

Bear in mind, I have attempted to provide some suggestions for formulas, but it is v difficult to check them against all your cases, and there might be alternative (better) ways of doing it.  
You might want to visit [regex101.com](http://regex101.com) to play around with regex to see if you can debug any problems you encounter.

---

<div class="post-metadata">

### Author: ![Minh\_Tri\_Do\_Hang](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/minh_tri_do_hang/32/6791_2.png) [@Minh\_Tri\_Do\_Hang](https://community.fibery.io/u/Minh_Tri_Do_Hang)
#### Post date: [September 22, 2023, 2:20am UTC](https://community.fibery.io/t/extracting-name-from-text/5181/8 "2023-09-22T02:20:38Z")

</div>

I followed you guidance and modify a bit to make it works.  
Another thing’s comming 's text convert:  
In this case, I can extract a several fields  
🕙 10:42 - 👩‍🌾 Huy - ⌛ 20:00 → 20:15 31-Aug-2023

- 🕙 ⇄ 10:00 (just string, not date time format) ⇒ I wanna convert it to Dates time
- 10:42 ⇄ the time this employee came late ⇒ I wanna convert it to Dates time to calculate the Late Duration for each employee Each week
- 20:00 → 20:15 (duration for real overtime) ⇒ Can we convert it to Dates Range to calculate the Overtime Duration for eachweek
- 31-Aug-2023 (still string, not date time) ⇒ I wanna convert to 31/08/2023 (Date time) to trigger set relation automatic with your Periodic Database  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/1/10e4a8073712b951b12600d73e94436db4cba5eb.png)

To sum up, Do we have any way to convert those string (plain text) field into date time or duration ? I feel really limited about formula in fibery right now

---

<div class="post-metadata">

### Author: ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)
#### Post date: [September 22, 2023, 6:07am UTC](https://community.fibery.io/t/extracting-name-from-text/5181/9 "2023-09-22T06:07:53Z")

</div>

> [@Minh\_Tri\_Do\_Hang](#):
>
> Do we have any way to convert those string (plain text) field into date time or duration ?

There is no way to convert strings to numbers using a formula.  
And since a date/datetime is a specifically formatted set of numbers, it’s not possible.
