我需要在下面使用Regex语法分隔文本。实际上,我找到了dddd-dddd
和dddd-ddd[x]
的食谱。文字呢?我需要获取具有以下值的字符串:"British Journal of Applied Science & Technology"
。如何用正则表达式编写?
337 British Journal of Applied Science & Technology 2231-0843 5
338 British Journal of Economics, Management & Trade 2278-098X 5
339 British Journal of Education, Society & Behavioural Science 2278-0998 6
340 British Journal of Environment and Climate Change 2231-4784 5
341 British Journal of Mathematics & Computer Science 2231-0851 4
342 British Journal of Medicine and Medical Research 2231-0614 8
343 British Journal of Pharmaceutical Research 2231-2919 4
344 British Microbiology Research Journal 2231-0886 9
345 Bromatologia i Chemia Toksykologiczna 0365-9445 5
346 Budownictwo Górnicze i Tunelowe 1234-5342 5
347 Budownictwo i Architektura 1899-0665 3
348 Budownictwo, Technologie, Architektura 1644-745X 3
349 Builder 1896-0642 2
350 Built Environment 0263-7960 10
351 Bulgarian Journal of Veterinary Medicine 1311-1477 8
352 Bulgarian Medicine 1314-3387 2
353 Bulletin de la Société des sciences et des lettres de Łódź, Série: Recherches sur les déformations 0459-6854 7
354 Bulletin of Alfred Nobel University. Series "Legal Science" 2226-2873 6
355 Bulletin of Geography. Socio-economic Series 1732-4254 10
356 Bulletin of Geography: Physical Geography Series 2080-7686 9
357 Bulletin of the Polish Academy of Sciences. Mathematics 0239-7269 9
358 Business and Economic Horizons 1804-1205 8
359 Business and Economics Research Journal 1309-2448 10
360 Business Process Management Journal 1463-7154 10
最佳答案
(?<=\d\s)\D+(?=\s\d)
那应该找到您所需要的。如果您对它的工作方式感兴趣:
正则表达式的第一部分(
(?<=\d\s)
)声明搜索的短语必须在数字(\d
)后跟空格(\s
)之后。第二部分(
\D+
)是实际找到的内容。它表示任意数量的非数字字符。第三部分(
(?=\s\d)
)确保结果后跟另一个空格和数字。