嗨,我有一个字符串,想提取一个与正则表达式匹配的子字符串,我当前拥有的代码删除了我希望它成为唯一应该保留的部分的子字符串。
我有什么,这将其删除,我想保留它:
String ticketReference = "You have been assigned to the following Support Ticket: ST-00003 bla bla bla";
ticketReference = ticketReference.replaceAll("'((ST-)[0-9]{5})", " ");
所需输出:“ST-00003”
提前感谢