extr_post_category returns the category of a PTT post title.

extr_post_category(post_title)

Arguments

post_title

Character. UTF-8 encoding and no leading space in string.

Value

If there is square-bracket-match or Re:-match, the function returns a string. Else, the function returns string No.

Details

This function extracts the category from the title based on regular expressions. It extracts the content inside the square brackets ([, ]) of the title. If there is no square bracket, it searches for Re: and extracts this pattern. If neither is matched, the function returns string No.