Hi,
The meaing of ^[0-9] is to exclude the characters specified in the [..], but what is the meaning of ^[0-9][0-9]*$.

The expression is used to get the process information from /proc , it lists all the PIDs of all running processes with some appended text.

but could not understand the meaning.

Recommended Answers

Actually:

[^0-9]

excludes characters.

^

at the start means the start of the string.

^[0-9][0-9]*$

means a string starting with 0-9, followed by any amount of 0-9's (and nothing else).

Jump to Post

All 2 Replies

Actually:

[^0-9]

excludes characters.

^

at the start means the start of the string.

^[0-9][0-9]*$

means a string starting with 0-9, followed by any amount of 0-9's (and nothing else).

ohhh! i understand now,all the directories in /proc are started with a number for the running processes and others to store system information, so they extracting information from only running processes.

Thank a bunch pritaeas.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.