String path = "人生若隻如初見,何事秋風悲畫扇."; String n = path.replaceAll("若.*風", ""); System.out.println("替換後的内容:" +n);