Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ([^:]*):(.*)
- sed 's/([^:]*):(.*)/1/' /etc/passwd
- 1st Capturing Group ([^:]*)
- Match a single character not present in the list below [^:]*
- * Quantifier — Matches between zero and unlimited times, as many times as possible, giving back as needed (greedy)
- : matches the character : literally (case sensitive)
- : matches the character : literally (case sensitive)
- 2nd Capturing Group (.*)
- .* matches any character (except for line terminators)
- * Quantifier — Matches between zero and unlimited times, as many times
- sed 's/([^:]*):
- /([^:]*): Match the string till you see a colon `:` and group.
- sed (.*)/1/' /etc/passwd
- (.*) Match everything after `:` and group
- sed 's/([^:]*):(.*)/12/' <<<"Hello:Unix:Users"
- HelloUnix:Users
- sed 's/([^:]*):(.*)/1;2/' <<<"Hello:Unix:Users"
- sed 's/([^:]*):(.*)/1 Linux and 2/' <<<"Hello:Unix:Users"
- (any symbol except : repeated zero or more times):(any symbol remeated zero or more times)
- sed -r 's/([^:]*):(.*)/1/' /etc/passwd
- root
- daemon
- bin
- sys
- sync
- games
Add Comment
Please, Sign In to add comment