時刻「〇時〇分」の抽出について

いつも大変お世話になっております。

下記の文字列の中かkら「16時00分」のみ抽出したいのですが、うまくいきません。
「令和5年10月31日(火)16時00分(必着とする。)」

Invoke Methodを設置したうえで、
image

代入で、
時刻=System.Text.RegularExpressions.Regex.Match(日にち,“(午前|午後)\d+時(\d+分)?”).Value
としましたが、
「時刻」の中は空になっています。

おわかりになることがあればご教授ください。

こんにちは

午前または午後が無いので

System.Text.RegularExpressions.Regex.Match(日にち,"\d+時(\d+分)?").Value

System.Text.RegularExpressions.Regex.Match(日にち,"(午前|午後)?\d+時(\d+分)?").Value

のいずれかお試しください

1 Like

Hi @kiki1

Try this

\d{1,}:\d{1,}

Hi @kiki1

You can use the below regular expression,

- Assign -> Input = "Tuesday, October 31, Reiwa 5, 16:00 (must arrive)"
- Assign -> output = System.Text.RegularExpressions.Regex.Match(Input,"(\d+:\d+)")

image

Hope it helps!!

Hope it helps!!

参考になりました。
ありがとうございます :relieved:

1 Like

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