简体   繁体   中英

How to find specific related word from string of java

Hi I have a Java String to check for particular word (month). This indicates which date format is used.

For example String is as below: SongName=TRIM(@SongName),AlbumName=TRIM(@AlbumName),Month=str_to_date(TRIM(@Month),'%d-%m-%Y'),

I only know the "Month"-part. The rest is unknown or unavailable for me. I want %d-%m-%Y for the word (Month) out of the string.

REGEX Pattern: @Month\\\\),'(\\\\.+?)'\\\\) I did not test it, but it should do. This regex extracts one or more characters of "any char" between @Month),' and '). Part you are looking for will be in group 1.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM