Remove dates from task names using dataview

Hi,

I’m using dateviewjs to print a list of tasks

const today = dv.date('today')
const myTasks = dv.pages('').file.tasks

dv.header(2, "Overdue")
dv.table(["Task","Link","Start date","Due date"], myTasks.filter(t=> (!t.completed) & (t.due < today)).sort(t=>t.date).map(t=>[t.text, t.link, t.start, t.due]))

When I print the text of the task (t.text) I the name of the task + the icons for start/scheduled/due dates + start/scheduled/due dates.

I would like to have only the name of the task, without the icons or the date.
Inspecting the task object seems that there’s a way to get the start/scheduled/due dates alone but no the task name only.

Any simple solution?

Otherwise I’m considering to create a function to “clean” the text by searching for date formats and replacing with ‘’.

Thanks,
Gianluca

I think you need to apply some type of regex to the task text… because tasks.text contains all the raw content in each task.

Topic

Summary
  • How to get the name of the task item(or the list item) without the DVIFs and the start/scheduled/due/completion/created dates? (DQL10)
  • How to get the name of the task item(or the list item) without the icons(or DVIFs) and the start/scheduled/due/completion/created dates? (DVJS10)
  • PS.from T.text of the file.tasks or L.text of the file.lists where T(or L) is an element of file.tasks(or file.lists)

Test

Summary
  • dataview: v0.5.46

Input

Summary

dictionary files:

  • Location: “100_Project/01_dataviewjs/01_by_example/Q86_TaskName/Q86_test_data”

folder: 03_no_icons

  • filename : dic_19860301
---
Date: 1986-03-01
---
#Project/P03

## input
### no_icons
- [ ] add this feature_a [start::1986-03-10] [scheduled::1986-03-05] [due::1986-03-30] [completion::1986-03-25] [created::1986-03-01]  #Test/d03 [[Note P]] , [[Note Q]]
- [ ] add this feature_b [start::1986-04-10] [scheduled::1986-04-05] [due::1986-04-30] [completion::1986-04-25] [created::1986-04-01] #Test/d04  [[Note P]]
- [ ] add this feature_c [start::1986-05-10] [scheduled::1986-05-05] [due::1986-05-30] [completion::1986-05-25] [created::1986-05-01] [[Note Q]] , [[Note J]]
- [ ] add this feature_d [start::1986-06-10] [scheduled::1986-06-05] [due::1986-06-30] [completion::1986-06-25] [created::1986-06-01] #Test/d06 #Test/d08
- [ ] add this feature_e %%(start::1986-07-10)%% %%(scheduled::1986-07-05)%% (due::1986-07-30) (completion::1986-07-25) %%(created::1986-07-01)%% #Test/d07 [[Note Q]]
- [ ] add this feature_f %%(start::1986-08-10)%% %%(scheduled::1986-08-05)%% %%(due::1986-08-30)%% %%(completion::1986-08-25)%% %%(created::1986-08-01)%% #Test/d08



folder: 04_use_icons

  • filename : dic_19860401
---
Date: 1986-04-01
---
#Project/P04

## input
### use_icons
- [ ] add this feature_A 🛫1986-04-10 #Test/d04 [[Note P]] , [[Note Q]]
    - [ ] PS.start
- [ ] add this feature_B ⏳1986-05-05  #Test/d05  [[Note P]]
    - [ ] PS.scheduled
- [ ] add this feature_C 📅1986-06-30 [[Note Q]] , [[Note J]]
    - [ ] PS.due
- [ ] add this feature_D ✅1986-07-25 #Test/d07
    - [ ] PS.completion
- [ ] add this feature_E ➕1986-08-01 #Test/d08 #Test/d10
    - [ ] PS.created
- [ ] add this feature_F 🛫1986-09-10 ⏳1986-09-05 📅1986-09-30 ✅1986-09-25 ➕1986-09-01 #Test/d09 [[Note P]] 
    - [ ] PS.start- scheduled <br>- due - completion - created



folder: 05_no_tasks

  • filename : dic_19860501
---
Date: 1986-05-01
---
#Project/P05

## input
### milestones
- [name:: "Black Coffee"] [price:: 120] [caffeine content:: 300] #Test/d01 [[Note J]] , [[Note K]]
- [name:: "Green Tea"] [price:: 100] [caffeine content:: 200] #Test/d02  [[Note J]]
- [name:: "Apple Juice"] [price:: 110] [caffeine content:: 0] [[Note Q]] , [[Note J]]
- [name:: "Iced Chocolate"] [price:: 130] [caffeine content:: 0] #Test/d04 #Test/d06
- [name:: "Hot Chocolate"] [price:: 105] [caffeine content:: 0] #Test/d05 [[Note K]]



folder: 06_empty_milestones

  • filename : dic_19860601
---
Date: 1986-06-01
---
#Project/P06

## input
### milestones
### some events
### other events




folder: 07_empty_tasks

  • filename : dic_19860701
---
Date: 1986-07-01
---
#Project/P07

## input
### main tasks
### some tasks
### other tasks




DQL10_get_the_name_of_the_task_and_TABLE

Summary

Main DQL

Code Name Data type Group By Purposes Remark
DQL10
_get_the_name
_of_the_task
_and_TABLE
T.text:
a string with a DVIF
no 1.To get the name of the task item(or the list item)
without the DVIFs and the start/scheduled/due/completion/created dates
from T.text of the file.tasks or L.text of the file.lists
where T(or L) is an element of file.tasks(or file.lists)

2.To display the result as a table
1.DVIF=Dataview inline field

2.The DQL10 is based on the the DVJS10 in the topic.

Code DQL10_get_the_name_of_the_task_and_TABLE

Summary_code
title: DQL10_get_the_name_of_the_task_and_TABLE =>1.To get the name of the task item(or the list item) without the DVIFs and the start/scheduled/due/completion/created dates from `T.text` of the file.tasks or `L.text` of the file.lists where `T`(or `L`) is an element of file.tasks(or file.lists) 2.To display the result as a table
collapse: close
icon: 
color: 
```dataview
TABLE WITHOUT ID
      F4_remove_OUTLINKS AS "Task",
      T.link AS "Link",
      dateformat(T.start, "yyyy-MM-dd") AS "Start date",
      dateformat(T.scheduled, "yyyy-MM-dd") AS "Scheduled date",  
      dateformat(T.due, "yyyy-MM-dd") AS "Due date",
      dateformat(T.completion, "yyyy-MM-dd") AS "Completed date",  
      dateformat(T.created, "yyyy-MM-dd") AS "Created date"
      
FROM "100_Project/01_dataviewjs/01_by_example/Q86_TaskName/Q86_test_data/03_no_icons"
FLATTEN file.tasks AS T
FLATTEN regexreplace(T.text, "(?:\[[^:\[\]\(\)]+?::.*?\])", "") AS F1_remove_DVIF_IN_SQUARE_BRACKETS
FLATTEN regexreplace(F1_remove_DVIF_IN_SQUARE_BRACKETS, "(?<!%%)(?:\([^:\[\]\(\)]+?::.*?\))(?!%%)", "") AS F2_remove_DVIF_IN_ROUND_BRACKETS

FLATTEN regexreplace(F2_remove_DVIF_IN_ROUND_BRACKETS, "(?<=\s)(?:#[^#\s]+)(?=\s*)", "") AS F3_remove_TAGS
FLATTEN regexreplace(F3_remove_TAGS, "(?<=\s)(?:\[\[([^\[\]]*?)\]\])\s*,*", "") AS F4_remove_OUTLINKS


```

Screenshots(DQL10):


DVJS10_get_the_name_of_the_task_and_TABLE

Summary

Main DVJS

Code Name Data type Group By Purposes Remark
DVJS10
_get_the_name
_of_the_task
_and_TABLE
T.text:
1.a string with a DVIF
2.a string with a icon
no 1.To get the name of the task item(or the list item)
without the icons and the start/scheduled/due/completion/created dates
from T.text of the file.tasks or L.text of the file.lists
where T(or L) is an element of file.tasks(or file.lists)

2.To display the result as a table
1.Require the fun_clean function
2.DVIF=Dataview inline field

Notes

Summary

Q1: How to get the Unicode like \u2705 from an icon like “:white_check_mark:”?

Summary_Q1

A1:

```JS
// T11. define icons: 
// ⏳ : U+23F3  = \u{23F3}
// 📅: U+1F4C5 = \u{1F4C5}
// ✅: U+2705  = \u{2705}
// ➕: U+2795  = \u{2795}
// #####################################################################
let icons = "⏳📅✅➕";


// T21. encode icons:  Icons To Unicode Code Point(Hexadecimal)
// #####################################################################
dv.span([...icons].map(i => "u+" + i.codePointAt().toString(16)).toUpperCase());

```

Screenshots(A1)

```md
\u23F3
\u1F4C5
\u2705
\u2795
```

Q2: How to get an icon like “:white_check_mark:” from the Unicode like \u2705?

Summary_Q2

A2:

```JS
// T11. define icons: 
// ⏳ : U+23F3  = \u{23F3}
// 📅: U+1F4C5 = \u{1F4C5}
// ✅: U+2705  = \u{2705}
// ➕: U+2795  = \u{2795}
// #####################################################################
let icons = "\u{23F3}\u{1F4C5}\u{2705}\u{2795}";


// T21. decode icons: Unicode Code Point(Hexadecimal) To Icons
// #####################################################################
dv.span(icons.split());

```

Screenshots(A2)

```md
⏳📅✅➕
```

Q3: What does the following Regular Expression mean? (F31)

Summary_Q3
```JS
    // F31. define IMPLICIT_FIELDS_TAGS_REGEX: #Test/d06
    // ##################################################################### 
    // input:add this feature_d [start::1986-06-10] [scheduled::1986-06-05] [due::1986-06-30] [completion::1986-06-25] [created::1986-06-01] #Test/d06 #Test/d08
    // output:#Test/d06 #Test/d08
    // Capturing Group (x) :
    // const IMPLICIT_FIELDS_TAGS_REGEX = /(?<=\s)(#[^#\s]+)(?=\s*)/g;
    // Non-Capturing Group (?:x) : (For better performance)
    // const IMPLICIT_FIELDS_TAGS_REGEX = /(?<=\s)(?:#[^#\s]+)(?=\s*)/gu; //FOR DQL10
    
    // Designed in dataview_v0.5.46
    // A -tag of the form '#stuff/hello-there'.
    // tag: _ => parsimmon_umd_min.exports.seqMap(parsimmon_umd_min.exports.string("#"), parsimmon_umd_min.exports.alt(parsimmon_umd_min.exports.regexp(/[\p{Letter}0-9_/-]/u).desc("text"),    
    // Positive Lookbehind(?<=A) + Non-Capturing Group(?:x) + Positive Lookahead(?=Z) : (For better performance)
    const IMPLICIT_FIELDS_TAGS_REGEX = /(?<=\s)(?:#[\p{Letter}0-9_/-]+)(?=\s*)/gu;
  

```

A3:

  • Positive Lookbehind(?<=A) + Non-Capturing Group (?:x) + Positive Lookahead(?=Z)
    • Positive Lookbehind (?<=\s)
    • Non-Capturing Group (?:#[\p{Letter}0-9_/-]+)
    • Positive Lookahead (?=\s*)
  • Global pattern flags
    • g modifier: global. All matches (don’t return after first match)
    • u modifier: unicode. Enable all unicode features and interpret all unicode escape sequences as such
Screenshots(DVJS10_A3)
Part 1/2

Part 2/2


Q4: What does the following Regular Expression mean? (F23)

Summary_Q4
```JS
    // F23. define DVIF_IN_ROUND_BRACKETS_REGEX: (due:: )
    // #####################################################################       
    // these textual fields (due:: ) (completion:: )
    // excluding %%(start:: )%% %%(scheduled:: )%% %%(created::1986-08-01)%%
    // input:add this feature_e %%(start::1986-07-10)%% %%(scheduled::1986-07-05)%% (due::1986-07-30) (completion::1986-07-25) %%(created::1986-07-01)%% #Test/d07 [[Note Q]]
    // output:(due::1986-07-30) (completion::1986-07-25)
    // Capturing Group (x) + greedy :
    // const DVIF_IN_ROUND_BRACKETS_REGEX = /(?<!%%)(\([^:\[\]\(\)]+::.*\))(?!%%)/g;
    
    // Negative Lookbehind`(?<!A)` + Non-Capturing Group(?:x) + Negative Lookahead`(?!Z)` : (For better performance)
    const DVIF_IN_ROUND_BRACKETS_REGEX = /(?<!%%)(?:\([^:\[\]\(\)]+?::.*?\))(?!%%)/gu;// non-greedy

```

A4:

  • Negative Lookbehind(?<!A) + Non-Capturing Group(?:x) + Negative Lookahead(?!Z)
    • Negative Lookbehind (?<!%%)
    • Non-Capturing Group (?:\([^:\[\]\(\)]+?::.*?\))
      • non-greedy y+?
      • non-greedy y*?
    • Negative Lookahead (?!%%)
  • Global pattern flags
    • g modifier: global. All matches (don’t return after first match)
    • u modifier: unicode. Enable all unicode features and interpret all unicode escape sequences as such
Screenshots(DVJS10_A4)
Part 1/3

Part 2/3

Part 3/3


Q5: How to remove a specific icon with an ISO date like :hourglass_flowing_sand:1986-05-05?

Summary_Q5

A5:

```JS
// T11. define icons:
// #####################################################################
let icons = `add this feature_B ⏳1986-05-05  #Test/d05  [[Note P]]`;


// F43. define SCHEDULED_DATE_REGEX: ONLY for ⏳1986-05-05
// #####################################################################
// input:add this feature_B ⏳1986-05-05  #Test/d05  [[Note P]]
// output:⏳1986-05-05
// [Hourglass with Flowing Sand Emoji](https://unicode-table.com/en/23F3/)
// 0x23F3   2022-10-17 by Justdoitcc
// Remarked by Justdoitcc 2022-11-03
const SCHEDULED_DATE_REGEX = /\u{23F3}\s*(\d{4}-\d{2}-\d{2})/u;


// T91. output:
// #####################################################################
dv.span("T91:<br>");
dv.span(icons.replace(SCHEDULED_DATE_REGEX, "")); //
dv.span("<br>");

```

Screenshots(A5)

```md
T91:
add this feature_B #Test/d05 [[Note P]]
```

Q6: How to remove any icon like “:hourglass_flowing_sand::date::white_check_mark::heavy_plus_sign:”?

Summary_Q6

A6:

```JS
// T11. define icons:
// #####################################################################
let icons = `⏳📅✅➕`;


// T21. define regexp: complicated emojis like ⏳📅✅➕
// If you need to get rid of complicated emojis, 
// you have to remove also additional things like modifiers and etc.
// *#0-9 - are Emoji characters with a text representation by default, per the Unicode Standard.
// #####################################################################
let regexp =
    /(?![*#0-9]+)[\p{Emoji}\p{Emoji_Modifier}\p{Emoji_Component}\p{Emoji_Modifier_Base}\p{Emoji_Presentation}]/gu;


// T91. output:
// #####################################################################
dv.span("T91:<br>");
dv.span(icons.replace(regexp, "")); //
dv.span("<br>");

```

Screenshots(A6)

```md
T91:
```

Q7: How to remove any icon with an ISO date like :hourglass_flowing_sand:1986-09-05?

Summary_Q7

A7:

```JS
// T11. define icons:
// #####################################################################
let icons = `add this feature_F 🛫1986-09-10 ⏳1986-09-05 📅1986-09-30 ✅1986-09-25 ➕1986-09-01 #Test/d09 [[Note P]] `;


// F51. define ICON_AND_ANY_ISO_DATE_REGEX: 
// any icon with an ISO date like ⏳1986-09-05
// To deal with what F41~F49 do : 
// #####################################################################
// input:add this feature_F 🛫1986-09-10 ⏳1986-09-05 📅1986-09-30 ✅1986-09-25 ➕1986-09-01 #Test/d09 [[Note P]] 
// output:🛫1986-09-10 ⏳1986-09-05 📅1986-09-30 ✅1986-09-25 ➕1986-09-01
// Solutions by grabus at 2021-10-25: 
// [How to remove emoji code using javascript?](https://stackoverflow.com/questions/10992921/how-to-remove-emoji-code-using-javascript)
// If you need to get rid of complicated emojis, 
// you have to remove also additional things like modifiers and etc.
// *#0-9 - are Emoji characters with a text representation by default, per the Unicode Standard.
const ICON_AND_ANY_ISO_DATE_REGEX =
    /(?![*#0-9]+)[\p{Emoji}\p{Emoji_Modifier}\p{Emoji_Component}\p{Emoji_Modifier_Base}\p{Emoji_Presentation}]\s*?(?:\d{4}-\d{2}-\d{2})/gu;


// T91. output:
// #####################################################################
dv.span("T91:<br>");
dv.span(icons.replace(ICON_AND_ANY_ISO_DATE_REGEX, "")); //
dv.span("<br>");

```

Screenshots(A7)

```md
T91:
add this feature_F #Test/d09 [[Note P]]
```

Code DVJS10_get_the_name_of_the_task_and_TABLE

Summary_code
title: DVJS10_get_the_name_of_the_task_and_TABLE => 0.Require the `fun_clean` function 1.To get the name of the task item(or the list item) without the icons and the start/scheduled/due/completion/created dates from `T.text` of the file.tasks or `L.text` of the file.lists where `T`(or `L`) is an element of file.tasks(or file.lists) 2.To display the result as a table
collapse: open
icon: 
color: 
```dataviewjs
// M10. define today: 
// #####################################################################
// const today = dv.date('today'); //org


// M11. define myTasks : gather all relevant Tasks 
// #####################################################################
let myTasks = dv
    .pages(
        '"100_Project/01_dataviewjs/01_by_example/Q86_TaskName/Q86_test_data"'
    )
    // The following expression can be omitted in the DVJS.
    //.where((page) => page.file.tasks.length > 0)
    .file.tasks;
    // .filter((T) => T.due)
    //// .filter((T) => T.date)
    // .filter((T) => !T.completed & (T.due < today)) //org
    //// .sort((T) => T.date); //org

 
// M51. TABLE : 
// #####################################################################
dv.table(
    [
        "Task",
        "Link",
        "Start date",
        "Scheduled date",
        "Due date",
        "Completed date",
        "Created date",
    ],
    myTasks.map((T) => [
        fun_clean(T.text),
        T.link,
        dv.func.dateformat(T.start, "yyyy-MM-dd"),
        dv.func.dateformat(T.scheduled, "yyyy-MM-dd"),
        dv.func.dateformat(T.due, "yyyy-MM-dd"),
        dv.func.dateformat(T.completion, "yyyy-MM-dd"),
        dv.func.dateformat(T.created, "yyyy-MM-dd"),
    ])
);


// M90. define fun_clean(): return a string
// To get the name of the task item(or the list item)   
// without the icons and the start/scheduled/due/completion/created dates
// from `T.text` of the file.tasks or `L.text` of the file.lists
// where `T`(or `L`) is an element of file.tasks(or file.lists)
// #####################################################################
// version : 2022-11-03 v1.00 Justdoitcc
function fun_clean(text="") {
    
    // F10. define sText:
    // #####################################################################
    let sText = text;

    // F11. check sText : 
    // #####################################################################
    if (sText === "") {
        return sText;
    }


    // F21. define DVIF_IN_SQUARE_BRACKETS_REGEX: [due:: ]
    // #####################################################################    
    // these textual fields [start:: ] [scheduled:: ] [due:: ] [completion:: ] [created:: ]
    // input:add this feature_d [start::1986-06-10] [scheduled::1986-06-05] [due::1986-06-30] [completion::1986-06-25] [created::1986-06-01] #Test/d06 #Test/d08
    // output:[start::1986-06-10] [scheduled::1986-06-05] [due::1986-06-30] [completion::1986-06-25] [created::1986-06-01]
    // Capturing Group (x) + greedy :
    // const DVIF_IN_SQUARE_BRACKETS_REGEX = /(\[[^:\[\]\(\)]+::.*\])/;
    // Capturing Group (x) + non-greedy :
    // const DVIF_IN_SQUARE_BRACKETS_REGEX = /(\[[^:\[\]\(\)]+?::.*?\])/g;
    
    // Non-Capturing Group (?:x) + non-greedy : (For better performance)
    const DVIF_IN_SQUARE_BRACKETS_REGEX = /(?:\[[^:\[\]\(\)]+?::.*?\])/gu;  
    
    
    // F23. define DVIF_IN_ROUND_BRACKETS_REGEX: (due:: )
    // #####################################################################       
    // these textual fields (due:: ) (completion:: )
    // excluding %%(start:: )%% %%(scheduled:: )%% %%(created::1986-08-01)%%
    // input:add this feature_e %%(start::1986-07-10)%% %%(scheduled::1986-07-05)%% (due::1986-07-30) (completion::1986-07-25) %%(created::1986-07-01)%% #Test/d07 [[Note Q]]
    // output:(due::1986-07-30) (completion::1986-07-25)
    // Capturing Group (x) + greedy :
    // const DVIF_IN_ROUND_BRACKETS_REGEX = /(?<!%%)(\([^:\[\]\(\)]+::.*\))(?!%%)/g;
    
    // Negative Lookbehind`(?<!A)` + Non-Capturing Group(?:x) + Negative Lookahead`(?!Z)` : (For better performance)
    const DVIF_IN_ROUND_BRACKETS_REGEX = /(?<!%%)(?:\([^:\[\]\(\)]+?::.*?\))(?!%%)/gu;// non-greedy


    // F25. define DVIF_HIDDEN_IN_ROUND_BRACKETS_REGEX: %%(due:: )%%
    // ##################################################################### 
    // these textual fields %%(start:: )%%
    //// const DVIF_HIDDEN_IN_ROUND_BRACKETS_REGEX = /(%%\([^:]+::.*\)%%)/;   //greedy
    // const DVIF_HIDDEN_IN_ROUND_BRACKETS_REGEX = /(%%\([^:]+?::.*?\)%%)/g;  //non-greedy


    // F31. define IMPLICIT_FIELDS_TAGS_REGEX: #Test/d06
    // ##################################################################### 
    // input:add this feature_d [start::1986-06-10] [scheduled::1986-06-05] [due::1986-06-30] [completion::1986-06-25] [created::1986-06-01] #Test/d06 #Test/d08
    // output:#Test/d06 #Test/d08
    // Capturing Group (x) :
    // const IMPLICIT_FIELDS_TAGS_REGEX = /(?<=\s)(#[^#\s]+)(?=\s*)/g;
    // Non-Capturing Group (?:x) : (For better performance)
    // const IMPLICIT_FIELDS_TAGS_REGEX = /(?<=\s)(?:#[^#\s]+)(?=\s*)/gu; //FOR DQL10
    
    // Designed in dataview_v0.5.46
    // A -tag of the form '#stuff/hello-there'.
    // tag: _ => parsimmon_umd_min.exports.seqMap(parsimmon_umd_min.exports.string("#"), parsimmon_umd_min.exports.alt(parsimmon_umd_min.exports.regexp(/[\p{Letter}0-9_/-]/u).desc("text"),    
    // Positive Lookbehind(?<=A) + Non-Capturing Group(?:x) + Positive Lookahead(?=Z) : (For better performance)
    const IMPLICIT_FIELDS_TAGS_REGEX = /(?<=\s)(?:#[\p{Letter}0-9_/-]+)(?=\s*)/gu;
    
    
    // F33. define IMPLICIT_FIELDS_OUTLINKS_REGEX: [[Note Q]]
    // ##################################################################### 
    // input:add this feature_c [start::1986-05-10] [scheduled::1986-05-05] [due::1986-05-30] [completion::1986-05-25] [created::1986-05-01] [[Note Q]] , [[Note J]]
    // output:[[Note Q]] , [[Note J]]
    // const IMPLICIT_FIELDS_OUTLINKS_REGEX = /(?<=\s)(\[\[.+?\]\])\s*,*/g; //non-greedy

    // Designed in dataview_v0.5.46
    // An Obsidian link of the form [[<link>]].
    // link: _ => parsimmon_umd_min.exports.regexp(/\[\[([^\[\]]*?)\]\]/u, 1)
    // Non-Capturing Group (?:x) + non-greedy : (For better performance)
    const IMPLICIT_FIELDS_OUTLINKS_REGEX = /(?<=\s)(?:\[\[([^\[\]]*?)\]\])\s*,*/gu; 

   
    // F41. define START_DATE_REGEX: 🛫1986-04-10
    // #####################################################################
    // input:add this feature_A 🛫1986-04-10 #Test/d04 [[Note P]] , [[Note Q]]
    // output:🛫1986-04-10
    // [Airplane Departure Emoji](https://unicode-table.com/en/1F6EB/)
    // 0x1F6EB  2022-10-17 by Justdoitcc
    // Remarked by Justdoitcc 2022-11-03
    // const START_DATE_REGEX = /\u{1F6EB}\s*(\d{4}-\d{2}-\d{2})/u;
    

    // F43. define SCHEDULED_DATE_REGEX: ⏳1986-05-05
    // #####################################################################
    // input:add this feature_B ⏳1986-05-05  #Test/d05  [[Note P]]
    // output:⏳1986-05-05
    // [Hourglass with Flowing Sand Emoji](https://unicode-table.com/en/23F3/)
    // 0x23F3   2022-10-17 by Justdoitcc
    // Remarked by Justdoitcc 2022-11-03
    // const SCHEDULED_DATE_REGEX = /\u{23F3}\s*(\d{4}-\d{2}-\d{2})/u;
    

    // F45. define DUE_DATE_REGEX: 📅1986-06-30
    // #####################################################################
    // input:add this feature_C 📅1986-06-30 [[Note Q]] [[Note J]]
    // output:📅1986-06-30
    // [01_Calendar Emoji: 0x1F4C5](https://unicode-table.com/en/1F4C5/)
    // 0x1F4C5   2022-10-17 by Justdoitcc
    // const DUE_DATE_REGEX = /\u{1F4C5}\s*(\d{4}-\d{2}-\d{2})/u;
    
    
    // Designed in dataview_v0.5.46
    // [01_Calendar Emoji: 0x1F4C5](https://unicode-table.com/en/1F4C5/)
    // [02_Tear-Off Calendar (apple):0x1F4C6](https://unicode-table.com/en/1F4C6/)
    // [03_Spiral Calendar Pad Emoji (apple): 0x1F5D3](https://unicode-table.com/en/1F5D3/)
    // [04_Variation Selector-16 ](https://unicode-table.com/en/FE0F/)
    // Remarked by Justdoitcc 2022-11-03
    // 0x1F4C5 0x1F4C6 0x1F5D3 0xFE0F
    // const DUE_DATE_REGEX = /[\u{1F4C5}\u{1F4C6}\u{1F5D3}\u{FE0F}]{1,}\s*(\d{4}-\d{2}-\d{2})/u;


    // F47. define COMPLETION_DATE_REGEX: ✅1986-07-25
    // #####################################################################
    // input:add this feature_D ✅1986-07-25 #Test/d07
    // output:✅1986-07-25
    // Designed in dataview_v0.5.46 (DONE_DATE=COMPLETION_DATE)
    // [White Heavy Check Mark Emoji](https://unicode-table.com/en/2705/)
    // Remarked by Justdoitcc 2022-11-03
    // 0x2705
    // const COMPLETION_DATE_REGEX = /\u{2705}\s*(\d{4}-\d{2}-\d{2})/u;
    

    // F49. define CREATED_DATE_REGEX: ➕1986-08-01
    // #####################################################################
    // input:add this feature_E ➕1986-08-01 #Test/d08 #Test/d10
    // output:➕1986-08-01
    // Designed in dataview_v0.5.46
    // [Heavy Plus Sign Emoji](https://unicode-table.com/en/2795/)
    // Remarked by Justdoitcc 2022-11-03
    // 0x2795
    // const CREATED_DATE_REGEX = /\u{2795}\s*(\d{4}-\d{2}-\d{2})/u;


    // F51. define ICON_AND_ANY_ISO_DATE_REGEX: 
    // any icon with an ISO date like ⏳1986-09-05
    // To deal with what F41~F49 do : 
    // #####################################################################
    // input:add this feature_F 🛫1986-09-10 ⏳1986-09-05 📅1986-09-30 ✅1986-09-25 ➕1986-09-01 #Test/d09 [[Note P]] 
    // output:🛫1986-09-10 ⏳1986-09-05 📅1986-09-30 ✅1986-09-25 ➕1986-09-01
    // Solutions by grabus at 2021-10-25: 
    // [How to remove emoji code using javascript?](https://stackoverflow.com/questions/10992921/how-to-remove-emoji-code-using-javascript)
    // If you need to get rid of complicated emojis, 
    // you have to remove also additional things like modifiers and etc.
    // *#0-9 - are Emoji characters with a text representation by default, per the Unicode Standard.
    const ICON_AND_ANY_ISO_DATE_REGEX =
    /(?![*#0-9]+)[\p{Emoji}\p{Emoji_Modifier}\p{Emoji_Component}\p{Emoji_Modifier_Base}\p{Emoji_Presentation}]\s*?(?:\d{4}-\d{2}-\d{2})/gu;


    // F60. define sTextCleaned:
    // #####################################################################
    let sTextCleaned = sText;
    
    
    // F61. define REGEX_SEPARATOR_OF_DVIF: (For better performance)
    // #####################################################################
    const REGEX_SEPARATOR_OF_DVIF = /::/;
    

    // F63. update sTextCleaned:
    // Remove textual fields like the  following examples
    // Remove DVIF in square brackets: [due:: ] [completion:: ]
    // Remove DVIF in round brackets : (due:: ) (completion:: )
    // excluding each hidden DVIF    :  %%(due:: )%% %%(completion:: )%%
    // if sTextCleaned contains any string like "::"
    // #####################################################################
    if (REGEX_SEPARATOR_OF_DVIF.test(sTextCleaned)) {
        sTextCleaned = sTextCleaned
            //RP63_F21:Clean DVIF_IN_SQUARE_BRACKETS_REGEX
            .replace(DVIF_IN_SQUARE_BRACKETS_REGEX, "")
            //RP63_F23:Clean DVIF_IN_ROUND_BRACKETS_REGEX
            .replace(DVIF_IN_ROUND_BRACKETS_REGEX, "");
    }
      

    // F71. update sTextCleaned:
    // Remove implicit tags fields
    // Remove implicit outlinks fields   
    // #####################################################################
    sTextCleaned = sTextCleaned
        //RP71_F31:Clean IMPLICIT_FIELDS_TAGS_REGEX
        .replace(IMPLICIT_FIELDS_TAGS_REGEX, "") 
        //RP71_F33:Clean IMPLICIT_FIELDS_OUTLINKS_REGEX
        .replace(IMPLICIT_FIELDS_OUTLINKS_REGEX, "");  


    // F81. define REGEX_ICONS_OF_TASKS:  (For better performance)
    // icons: the start/scheduled/due/completion/created dates
    // #####################################################################
    const REGEX_ICONS_OF_TASKS =
        /[\u{1F6EB}⏳\u{1F4C5}\u{1F4C6}\u{1F5D3}\u{FE0F}✅➕]/u;
    
    
    // F83. update sTextCleaned:
    // Remove icon fields like the start/scheduled/due/completion/created dates
    // if sTextCleaned contains any icon like REGEX_ICONS_OF_TASKS
    // #####################################################################
    if (REGEX_ICONS_OF_TASKS.test(sTextCleaned)) {
        sTextCleaned = sTextCleaned
            // Added by Justdoitcc 2022-11-03
            // RP83_F51:Clean ICON_AND_ANY_ISO_DATE_REGEX
            .replace(ICON_AND_ANY_ISO_DATE_REGEX, "");
            
            // Remarked by Justdoitcc 2022-11-03
            // RP83_F41:Clean START_DATE_REGEX
            // .replace(START_DATE_REGEX, "")
            // RP83_F43:Clean SCHEDULED_DATE_REGEX
            // .replace(SCHEDULED_DATE_REGEX, "")
            // RP83_F45:Clean DUE_DATE_REGEX
            // .replace(DUE_DATE_REGEX, "")
            // RP83_F47:Clean COMPLETION_DATE_REGEX
            // .replace(COMPLETION_DATE_REGEX, "")
            // RP83_F49:Clean CREATED_DATE_REGEX
            // .replace(CREATED_DATE_REGEX, "");
    }


    // F90. return sTextCleaned:
    // #####################################################################
    return sTextCleaned;
}


```

Screenshots(DVJS10)


Reference

Summary

Easy peasy. Assuming you’re talking about the icons from Obsidian Tasks, you can use this regex to just remove any text that follows one of the special icons:

t.text.replace(/[📅⏳🛫⏫🔼🔽].*$/, '')

You’ve also got a mistake in your code where you’re using a single & when you should be using a double &&. You can read about the difference here.

So the full code would be:

const today = dv.date('today')
const myTasks = dv.pages('').file.tasks

dv.header(2, "Overdue")
dv.table(["Task","Link","Start date","Due date"], myTasks
  .filter(t => !t.completed && t.due < today)
  .sort(t => t.date)
  .map(t => [t.text.replace(/[📅⏳🛫⏫🔼🔽].*$/, ''), t.link, t.start, t.due]))