Dear all I have text file with lines like this.
> dput(x[9]) "PYedehYev: 300 s Záva~í: 2.160 kg" > dput(x[11]) "et odYezko: 3 \fas odYezku: 15 s" I am able to extract some numbers but others give me headache. gsub("^.*[^:] (\\d+.\\d+).*$", "\\1", x[9]) works for 300 gsub("^.*[:] (\\d+.\\d+).*$", "\\1", x[9]) works for 2.160 gsub("^.*: (\\d+).*$", "\\1", x[11]) works for 3 but only after many attempts I found that gsub("^.*[^:] (\\d+).*$", "\\1", x[11]) works for 15 Can somebody explain my why for line 11 second item requires almost equvalent regular expression as first item in line 9 and why just gsub("^.*[:] (\\d+).*$", "\\1", x[11]) does not produce 15 but 3??? Cheers Petr Osobní údaje: Informace o zpracování a ochraně osobních údajů obchodních partnerů PRECHEZA a.s. jsou zveřejněny na: https://www.precheza.cz/zasady-ochrany-osobnich-udaju/ | Information about processing and protection of business partner’s personal data are available on website: https://www.precheza.cz/en/personal-data-protection-principles/ Důvěrnost: Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a podléhají tomuto právně závaznému prohláąení o vyloučení odpovědnosti: https://www.precheza.cz/01-dovetek/ | This email and any documents attached to it may be confidential and are subject to the legally binding disclaimer: https://www.precheza.cz/en/01-disclaimer/ ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.