regex - How can I extract this substring with a regexp? -
i want extract number (which nonnegative integer) comes after "cache", not 1 comes after "total_cache". need able in single regular expression, , can't use lookahead or lookbehind. (i'm doing in go, appears largely compatible tester here: http://regexpal.com/)
cache 5764452352 rss 2929250304 rss_huge 0 mapped_file 283906048 pgpgin 19709097 pgpgout 17586611 pgfault 39612525 pgmajfault 3757 inactive_anon 160579584 active_anon 3931484160 inactive_file 3560427520 active_file 1040818176 unevictable 49152 hierarchical_memory_limit 9223372036854775807 total_cache 5764452352 total_rss 2929250304 total_rss_huge 0 total_mapped_file 283906048 total_pgpgin 19709097 total_pgpgout 17586611 total_pgfault 39612525 total_pgmajfault 3757 total_inactive_anon 160579584 total_active_anon 3931484160 total_inactive_file 3560427520 total_active_file 1040818176 total_unevictable 49152
you need use findstringsubmatch , extract m[1].
Comments
Post a Comment