Once upon a time, there were Yura, Moya-san, and Yura's entourage in a place called Twitter. Whenever Yura does something, the entourage says:
I will do the first half of the last word of Mr. Moya with Java regular expressions. Reference: http://www.javadrive.jp/regex/ I won't touch regular expressions in other languages.
First, let's divide "Yura-chan cute" (A) into two parts. Let's say "Yura-chan" (hereinafter B) and "cute" (hereinafter C).
Japanese is complicated.
There are some kana characters such as "a" and "a" that are the same.
Let's make B and C correspond to this, assuming that it does not correspond to the same reading kanji.
You can do this by using this.
B = [Yuyu] [Lalala] [Chichichi] [Yayaya] [Nun]
C = [Kakaka] [Wow Wow] [Iii] [Iii]
For C, "i" is always two consecutive, so use this to shorten it.
C = [Kakaka] [Wow Wow] [Iii] {2}
This is fine.
Regular expressions can be synthesized by concatenating the context as a character string unless the beginning and end are specified.
For example, if it is B + C
, 100% of the" Erachan Kawaii "will be caught.
But what if you say this?
"** Cute ** Yo ** Yura-chan **"
It will be difficult if it is inverted.
Here, use this and this Let's define a new D.
D=.*
D
will be caught in a string of 0 or more characters. (That is, it will get caught even if it is not)
If you use this, you can handle the previous inversion with C + D + B
.
Even if "Yura-chan is cute", you can handle it with B + D + C
.
Finally, let's combine multiple regular expressions into one. When I thought about it, a person who said this time appeared.
[Yuyu] [Lalala]
), combine this with B.
So what do you do?
Make sure that the "chan" part of B is also caught by "yura".
Here, use Candidate to synthesize.
B = [Yuyu] [Lalala]([Chi-Chi] [Yayaya] [Nun] | [Yuyu] [Lalala])
It's done.Let's get back to the main subject.
Combine using the above method so that the regular expression can search for B + D + C
and C + D + B
at the same time.
It will be long, but it will be like this. (Hereafter E)
E=([Yuyu][Lala]([ChiChiChi][Yayaya][Hmmmm]|[Yuyu][Lala]).*[Kakaka][WowWow][Iiii]{2}|[Kakaka][WowWow][Iiii]{2}.*[Yuyu][Lala]([ChiChiChi][Yayaya][Hmmmm]|[Yuyu][Lala]))
looks strong
You can probably find most of "Yura-chan cute" with this. Perhaps.
Moya: Twitter Yura: Twitter Thank you very much.
Yura is cute ~~ I'm sorry I'm not good at writing ~~ For the second part, go to here
Recommended Posts