[JAVA] A little regular expression story Part 2

The first part is from here

Notice

Part of the prologue of the first part is true, but the remarks of the characters in the second part are fiction.

From the first part

Last time, I made a regular expression to look for "Yura-chan is cute" ... Screenshot_20170113-001102.png Acha You were killed Moya also says ** "Measures to avoid searching" ** In this way, I created a new regular expression again.

Main subject

Introduction

The first part, ʻE`, is the result of the first part and will not be used in the second part. Therefore, it is a missing number. Other than that, it is inherited from the first part. The reference site is the same here as the first part.

Avoid searching

Let's do it.

I would like to say, but please take a closer look. You're using both [ and ], right? Is it a reserved character? I think it would be easier to use . * (D), but I would like to specify only the characters used to avoid searching. (However, the definition is ambiguous and various characters are used, so I will only think of it appropriately.) I still use this, but can I use escape (\\)?

In conclusion, can. So, define F by referring to here. F=[\[\]\/\\\s] All you have to do is put it in B and C (before "i" 2 continuous processing). B = [Yuyu] [\ [\] \ / \\\ s] [Lalala] [\ [\] \ / \\\ s]([Chi-Chi] [\ [\] \ / \\ \ s] [Yayaya] [\ [\] \ / \\\ s] [Nun] | [Yuyu] [\ [\] \ / \\\ s] [Lalala]) C = [Kakaka] [\ [\] \ / \\\ s] [Wow Wow] [\ [\] \ / \\\ s] [Good] [\ [\] \ / \\ \ s] [good] long. Then, I will do the same thing as the last thing I did in the first part. Synthesize B + D + C and C + D + B so that they are regular expressions that can be searched at the same time. It will be like this. (F) F=([Yuyu][\[\]\/\\\s][Lala][\[\]\/\\\s]([ChiChiChi][\[\]\/\\\s][Yayaya][\[\]\/\\\s][Hmmmm]|[Yuyu][\[\]\/\\\s][Lala]).*[Kakaka][\[\]\/\\\s][WowWow][\[\]\/\\\s][Iiii][\[\]\/\\\s][Iiii]|[Kakaka][\[\]\/\\\s][WowWow][\[\]\/\\\s][Iiii][\[\]\/\\\s][Iiii].*[Yuyu][\[\]\/\\\s][Lala][\[\]\/\\\s]([ChiChiChi][\[\]\/\\\s][Yayaya][\[\]\/\\\s][Hmmmm]|[Yuyu][\[\]\/\\\s][Lala])) ~~ It doesn't make sense anymore ~~ Isn't this all right?

Finally

~~ I'm sure some of you may have wondered if this is all, but ** I've run out of material **. ~~ If you have a plan, please let me know in the comments and I will probably do it.

Recommended Posts

A little regular expression story Part 1
A little regular expression story Part 2
A little troublesome story in Groovy
A little addictive story with def initialize
Regular expression basics
JS regular expression
Ruby regular expression
^, $ in Rails regular expression
unicode regular expression sample
Ruby Regular Expression Extracts from a specific string to a string
Regular expression for password
java regular expression summary
[Java] Cut out a part of the character string with Matcher and regular expression
[Ruby/Rails] How to generate a password in a regular expression
Extract a string starting with a capital letter with a regular expression (Ruby)
Full-width / half-width judgment regular expression
A little complicated conditional branching
Making a minute repeater part.2
Making a minute repeater part.1
Learn regular expressions little by little ①
A story stuck with NotSerializableException
A little addictive story after updating the JDBC driver for PostgreSQL
I want to extract between character strings with a regular expression