Date: 2021-09-22 04:36:34
Score: 6
Natty: 4
Report link

I am trying to write a Regex in Java. My ask is I need to split string by '/' and get the last entry. Looking at the above discussion managed to write regex which is working succesfully in php i.e expression: \S*^.?((?(?=.?(\b(?:/)\b).?)\1|.)).*?$

Inputs: /etc/audit/auditd.conf, /etc/audit/rules.d/audit.rules, /etc/audisp/plugins.d/syslog.conf, /etc/httpd/conf/httpd.conf, httpd.conf, rsyslog.conf

Respective outputs: (All in Group 1) auditd.conf, audit.rules, syslog.conf, httpd.conf, httpd.conf, rsyslog.conf. but when trying to write the same in java,

same expression is returning "? The preceding token is not quantifiable" error at (?( usage in the expression, upon escaping ? with \, error is gone but string is not returning last string split by '/'. Please help

  • Blacklisted phrase (0.5): I need
  • Blacklisted phrase (1): I am trying to
  • RegEx Blacklisted phrase (3): Please help
  • Long answer (-0.5):
  • No code block (0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: hitesh adabala