# 日にちの抽出について

**URL:** <https://forum.uipath.com/t/topic/711103>\
**Category:** フォーラム\
**Created:** [January 9, 2024, 6:28am UTC](https://forum.uipath.com/t/topic/711103 "2024-01-09T06:28:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kiki1](https://avatars.discourse-cdn.com/v4/letter/k/a9adbd/32.png) [@kiki1](https://forum.uipath.com/u/kiki1)\
**Post date:** [January 9, 2024, 6:28am UTC](https://forum.uipath.com/t/topic/711103/1 "2024-01-09T06:28:22Z")

</div>

いつも大変お世話になっております。  
Web上の文字列「令和07-03-22」を下記のコードを使用して、抽出したいのですが、「令和07-03-2」までしか抽出できません。お気づきの点ありましたらご教授ください。

日にち＝System.Text.RegularExpressions.Regex.Match(日にち,“(” +元号+“)\d+?-\d+?-\d+?”).Value

※「元号」には「令和」の文字列が入っています。

---

<div class="post-metadata">

**Author:** ![vrdabberu](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/vrdabberu/32/484365_2.png) [@vrdabberu](https://forum.uipath.com/u/vrdabberu)\
**Post date:** [January 9, 2024, 6:30am UTC](https://forum.uipath.com/t/topic/711103/2 "2024-01-09T06:30:05Z")

</div>

> [@kiki1](#):
>
> System.Text.RegularExpressions.Regex.Match(日にち,“(” +元号+“)\d+?-\d+?-\d+?”).Value

Hi @kiki1

```auto
System.Text.RegularExpressions.Regex.Match(日にち,"(" +元号+")\d*-\d*-\d*").Value

```

Hope it helps!!

---

<div class="post-metadata">

**Author:** ![Yoichi](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/yoichi/32/523754_2.png) [@Yoichi](https://forum.uipath.com/u/Yoichi)\
**Post date:** [January 9, 2024, 6:30am UTC](https://forum.uipath.com/t/topic/711103/3 "2024-01-09T06:30:29Z")

</div>

> [@kiki1](#):
>
> System.Text.RegularExpressions.Regex.Match(日にち,“(” +元号+“)\d+?-\d+?-\d+?”).Value

以下の様に?を削除してみてください

```
System.Text.RegularExpressions.Regex.Match(日にち,"(" +元号+")\d+-\d+-\d+").Value

```

---

<div class="post-metadata">

**Author:** ![kiki1](https://avatars.discourse-cdn.com/v4/letter/k/a9adbd/32.png) [@kiki1](https://forum.uipath.com/u/kiki1)\
**Post date:** [January 11, 2024, 2:42am UTC](https://forum.uipath.com/t/topic/711103/4 "2024-01-11T02:42:17Z")

</div>

返信遅くなり申し訳ありません。  
解決できました。  
ありがとうございます 😌

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/system/32/182466_2.png) [@system](https://forum.uipath.com/u/system)\
**Post date:** [January 14, 2024, 2:42am UTC](https://forum.uipath.com/t/topic/711103/5 "2024-01-14T02:42:45Z")

</div>

Closed on January 14, 2024, 2:42am UTC

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
