| 1 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 2 |
DENIED
|
moderate
|
App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
} |
|
Show voter details
|
| 3 |
DENIED
|
edit
|
App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
} |
|
Show voter details
|
| 4 |
DENIED
|
moderate
|
App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
} |
|
Show voter details
|
| 5 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 6 |
DENIED
|
moderate
|
App\Entity\EntryComment {#4126
+user: App\Entity\User {#4074 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "Congrats on your learning! I did a similar thing with music and converting all random songs to mp3"
+lang: "en"
+isAdult: false
+favouriteCount: 2
+score: 0
+lastActive: DateTime @1703604794 {#4135
date: 2023-12-26 16:33:14.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4124 …}
+nested: Doctrine\ORM\PersistentCollection {#4122 …}
+votes: Doctrine\ORM\PersistentCollection {#4120 …}
+reports: Doctrine\ORM\PersistentCollection {#4118 …}
+favourites: Doctrine\ORM\PersistentCollection {#4086 …}
+notifications: Doctrine\ORM\PersistentCollection {#4090 …}
-id: 253828
-bodyTs: "'congrat':1 'convert':13 'learn':4 'mp3':18 'music':11 'random':15 'similar':8 'song':16 'thing':9"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://midwest.social/comment/5726011"
+editedAt: null
+createdAt: DateTimeImmutable @1703604794 {#4071
date: 2023-12-26 16:33:14.0 +01:00
}
} |
|
Show voter details
|
| 7 |
DENIED
|
edit
|
App\Entity\EntryComment {#4126
+user: App\Entity\User {#4074 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "Congrats on your learning! I did a similar thing with music and converting all random songs to mp3"
+lang: "en"
+isAdult: false
+favouriteCount: 2
+score: 0
+lastActive: DateTime @1703604794 {#4135
date: 2023-12-26 16:33:14.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4124 …}
+nested: Doctrine\ORM\PersistentCollection {#4122 …}
+votes: Doctrine\ORM\PersistentCollection {#4120 …}
+reports: Doctrine\ORM\PersistentCollection {#4118 …}
+favourites: Doctrine\ORM\PersistentCollection {#4086 …}
+notifications: Doctrine\ORM\PersistentCollection {#4090 …}
-id: 253828
-bodyTs: "'congrat':1 'convert':13 'learn':4 'mp3':18 'music':11 'random':15 'similar':8 'song':16 'thing':9"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://midwest.social/comment/5726011"
+editedAt: null
+createdAt: DateTimeImmutable @1703604794 {#4071
date: 2023-12-26 16:33:14.0 +01:00
}
} |
|
Show voter details
|
| 8 |
DENIED
|
moderate
|
App\Entity\EntryComment {#4126
+user: App\Entity\User {#4074 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "Congrats on your learning! I did a similar thing with music and converting all random songs to mp3"
+lang: "en"
+isAdult: false
+favouriteCount: 2
+score: 0
+lastActive: DateTime @1703604794 {#4135
date: 2023-12-26 16:33:14.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4124 …}
+nested: Doctrine\ORM\PersistentCollection {#4122 …}
+votes: Doctrine\ORM\PersistentCollection {#4120 …}
+reports: Doctrine\ORM\PersistentCollection {#4118 …}
+favourites: Doctrine\ORM\PersistentCollection {#4086 …}
+notifications: Doctrine\ORM\PersistentCollection {#4090 …}
-id: 253828
-bodyTs: "'congrat':1 'convert':13 'learn':4 'mp3':18 'music':11 'random':15 'similar':8 'song':16 'thing':9"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://midwest.social/comment/5726011"
+editedAt: null
+createdAt: DateTimeImmutable @1703604794 {#4071
date: 2023-12-26 16:33:14.0 +01:00
}
} |
|
Show voter details
|
| 9 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 10 |
DENIED
|
moderate
|
App\Entity\EntryComment {#4163
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
It is a great book, although a bit outdated. In particular, nowadays `egrep` is not recommended to use. `grep -E` is a more portable synonim.\n
\n
Some notes on you script:\n
\n
1. You don’t need to escape slashes in grep regex. In the sed `s///` command better use another character like `s###` so you also can leave slashes unescaped.\n
2. You usually don’t need to pipe `grep` and `sed`, `sed -n` with regex address and explicit printing command gives the same result as `grep`.\n
3. You could omit leading slash in your `egrep` regex, so you won’t need to remove it later.\n
\n
So I would do the same with\n
\n
```\n
\n
<span style="color:#323232;">tar -tzvf file.tar.gz | sed -En '/.(mp4|mkv)$/{s#^.*/##; s#.[.*##; s#[^a-zA-Z0-9()&-]# #g; s/ +/ /g; p}'\n
</span>\n
```
"""
+lang: "en"
+isAdult: false
+favouriteCount: 14
+score: 0
+lastActive: DateTime @1708114193 {#4164
date: 2024-02-16 21:09:53.0 +01:00
}
+ip: null
+tags: [
"323232"
]
+mentions: [
"@harsh3466@lemmy.world"
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4161 …}
+nested: Doctrine\ORM\PersistentCollection {#4159 …}
+votes: Doctrine\ORM\PersistentCollection {#4157 …}
+reports: Doctrine\ORM\PersistentCollection {#4154 …}
+favourites: Doctrine\ORM\PersistentCollection {#4150 …}
+notifications: Doctrine\ORM\PersistentCollection {#4148 …}
-id: 251438
-bodyTs: "'/g':129 '1':31 '2':60 '3':86 '9':126 'a-za-z0':122 'address':75 'also':55 'although':6 'anoth':49 'better':47 'bit':8 'book':5 'charact':50 'command':46,79 'could':88 'e':20 'egrep':13,94 'en':116 'escap':37 'explicit':77 'file.tar.gz':114 'g':127 'give':80 'great':4 'grep':19,40,68,85 'later':104 'lead':90 'leav':57 'like':51 'mkv':118 'mp4':117 'n':72 'need':35,65,100 'note':27 'nowaday':12 'omit':89 'outdat':9 'p':130 'particular':11 'pipe':67 'portabl':24 'print':78 'recommend':16 'regex':41,74,95 'remov':102 'result':83 'script':30 'sed':44,70,71,115 'slash':38,58,91 'synonim':25 'tar':112 'tzvf':113 'unescap':59 'use':18,48 'usual':62 'won':98 'would':107 'z0':125 'za':124"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6875297"
+editedAt: DateTimeImmutable @1707737027 {#4169
date: 2024-02-12 12:23:47.0 +01:00
}
+createdAt: DateTimeImmutable @1703524389 {#4167
date: 2023-12-25 18:13:09.0 +01:00
}
} |
|
Show voter details
|
| 11 |
DENIED
|
edit
|
App\Entity\EntryComment {#4163
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
It is a great book, although a bit outdated. In particular, nowadays `egrep` is not recommended to use. `grep -E` is a more portable synonim.\n
\n
Some notes on you script:\n
\n
1. You don’t need to escape slashes in grep regex. In the sed `s///` command better use another character like `s###` so you also can leave slashes unescaped.\n
2. You usually don’t need to pipe `grep` and `sed`, `sed -n` with regex address and explicit printing command gives the same result as `grep`.\n
3. You could omit leading slash in your `egrep` regex, so you won’t need to remove it later.\n
\n
So I would do the same with\n
\n
```\n
\n
<span style="color:#323232;">tar -tzvf file.tar.gz | sed -En '/.(mp4|mkv)$/{s#^.*/##; s#.[.*##; s#[^a-zA-Z0-9()&-]# #g; s/ +/ /g; p}'\n
</span>\n
```
"""
+lang: "en"
+isAdult: false
+favouriteCount: 14
+score: 0
+lastActive: DateTime @1708114193 {#4164
date: 2024-02-16 21:09:53.0 +01:00
}
+ip: null
+tags: [
"323232"
]
+mentions: [
"@harsh3466@lemmy.world"
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4161 …}
+nested: Doctrine\ORM\PersistentCollection {#4159 …}
+votes: Doctrine\ORM\PersistentCollection {#4157 …}
+reports: Doctrine\ORM\PersistentCollection {#4154 …}
+favourites: Doctrine\ORM\PersistentCollection {#4150 …}
+notifications: Doctrine\ORM\PersistentCollection {#4148 …}
-id: 251438
-bodyTs: "'/g':129 '1':31 '2':60 '3':86 '9':126 'a-za-z0':122 'address':75 'also':55 'although':6 'anoth':49 'better':47 'bit':8 'book':5 'charact':50 'command':46,79 'could':88 'e':20 'egrep':13,94 'en':116 'escap':37 'explicit':77 'file.tar.gz':114 'g':127 'give':80 'great':4 'grep':19,40,68,85 'later':104 'lead':90 'leav':57 'like':51 'mkv':118 'mp4':117 'n':72 'need':35,65,100 'note':27 'nowaday':12 'omit':89 'outdat':9 'p':130 'particular':11 'pipe':67 'portabl':24 'print':78 'recommend':16 'regex':41,74,95 'remov':102 'result':83 'script':30 'sed':44,70,71,115 'slash':38,58,91 'synonim':25 'tar':112 'tzvf':113 'unescap':59 'use':18,48 'usual':62 'won':98 'would':107 'z0':125 'za':124"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6875297"
+editedAt: DateTimeImmutable @1707737027 {#4169
date: 2024-02-12 12:23:47.0 +01:00
}
+createdAt: DateTimeImmutable @1703524389 {#4167
date: 2023-12-25 18:13:09.0 +01:00
}
} |
|
Show voter details
|
| 12 |
DENIED
|
moderate
|
App\Entity\EntryComment {#4163
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
It is a great book, although a bit outdated. In particular, nowadays `egrep` is not recommended to use. `grep -E` is a more portable synonim.\n
\n
Some notes on you script:\n
\n
1. You don’t need to escape slashes in grep regex. In the sed `s///` command better use another character like `s###` so you also can leave slashes unescaped.\n
2. You usually don’t need to pipe `grep` and `sed`, `sed -n` with regex address and explicit printing command gives the same result as `grep`.\n
3. You could omit leading slash in your `egrep` regex, so you won’t need to remove it later.\n
\n
So I would do the same with\n
\n
```\n
\n
<span style="color:#323232;">tar -tzvf file.tar.gz | sed -En '/.(mp4|mkv)$/{s#^.*/##; s#.[.*##; s#[^a-zA-Z0-9()&-]# #g; s/ +/ /g; p}'\n
</span>\n
```
"""
+lang: "en"
+isAdult: false
+favouriteCount: 14
+score: 0
+lastActive: DateTime @1708114193 {#4164
date: 2024-02-16 21:09:53.0 +01:00
}
+ip: null
+tags: [
"323232"
]
+mentions: [
"@harsh3466@lemmy.world"
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4161 …}
+nested: Doctrine\ORM\PersistentCollection {#4159 …}
+votes: Doctrine\ORM\PersistentCollection {#4157 …}
+reports: Doctrine\ORM\PersistentCollection {#4154 …}
+favourites: Doctrine\ORM\PersistentCollection {#4150 …}
+notifications: Doctrine\ORM\PersistentCollection {#4148 …}
-id: 251438
-bodyTs: "'/g':129 '1':31 '2':60 '3':86 '9':126 'a-za-z0':122 'address':75 'also':55 'although':6 'anoth':49 'better':47 'bit':8 'book':5 'charact':50 'command':46,79 'could':88 'e':20 'egrep':13,94 'en':116 'escap':37 'explicit':77 'file.tar.gz':114 'g':127 'give':80 'great':4 'grep':19,40,68,85 'later':104 'lead':90 'leav':57 'like':51 'mkv':118 'mp4':117 'n':72 'need':35,65,100 'note':27 'nowaday':12 'omit':89 'outdat':9 'p':130 'particular':11 'pipe':67 'portabl':24 'print':78 'recommend':16 'regex':41,74,95 'remov':102 'result':83 'script':30 'sed':44,70,71,115 'slash':38,58,91 'synonim':25 'tar':112 'tzvf':113 'unescap':59 'use':18,48 'usual':62 'won':98 'would':107 'z0':125 'za':124"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6875297"
+editedAt: DateTimeImmutable @1707737027 {#4169
date: 2024-02-12 12:23:47.0 +01:00
}
+createdAt: DateTimeImmutable @1703524389 {#4167
date: 2023-12-25 18:13:09.0 +01:00
}
} |
|
Show voter details
|
| 13 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 14 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5425
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4163
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
It is a great book, although a bit outdated. In particular, nowadays `egrep` is not recommended to use. `grep -E` is a more portable synonim.\n
\n
Some notes on you script:\n
\n
1. You don’t need to escape slashes in grep regex. In the sed `s///` command better use another character like `s###` so you also can leave slashes unescaped.\n
2. You usually don’t need to pipe `grep` and `sed`, `sed -n` with regex address and explicit printing command gives the same result as `grep`.\n
3. You could omit leading slash in your `egrep` regex, so you won’t need to remove it later.\n
\n
So I would do the same with\n
\n
```\n
\n
<span style="color:#323232;">tar -tzvf file.tar.gz | sed -En '/.(mp4|mkv)$/{s#^.*/##; s#.[.*##; s#[^a-zA-Z0-9()&-]# #g; s/ +/ /g; p}'\n
</span>\n
```
"""
+lang: "en"
+isAdult: false
+favouriteCount: 14
+score: 0
+lastActive: DateTime @1708114193 {#4164
date: 2024-02-16 21:09:53.0 +01:00
}
+ip: null
+tags: [
"323232"
]
+mentions: [
"@harsh3466@lemmy.world"
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4161 …}
+nested: Doctrine\ORM\PersistentCollection {#4159 …}
+votes: Doctrine\ORM\PersistentCollection {#4157 …}
+reports: Doctrine\ORM\PersistentCollection {#4154 …}
+favourites: Doctrine\ORM\PersistentCollection {#4150 …}
+notifications: Doctrine\ORM\PersistentCollection {#4148 …}
-id: 251438
-bodyTs: "'/g':129 '1':31 '2':60 '3':86 '9':126 'a-za-z0':122 'address':75 'also':55 'although':6 'anoth':49 'better':47 'bit':8 'book':5 'charact':50 'command':46,79 'could':88 'e':20 'egrep':13,94 'en':116 'escap':37 'explicit':77 'file.tar.gz':114 'g':127 'give':80 'great':4 'grep':19,40,68,85 'later':104 'lead':90 'leav':57 'like':51 'mkv':118 'mp4':117 'n':72 'need':35,65,100 'note':27 'nowaday':12 'omit':89 'outdat':9 'p':130 'particular':11 'pipe':67 'portabl':24 'print':78 'recommend':16 'regex':41,74,95 'remov':102 'result':83 'script':30 'sed':44,70,71,115 'slash':38,58,91 'synonim':25 'tar':112 'tzvf':113 'unescap':59 'use':18,48 'usual':62 'won':98 'would':107 'z0':125 'za':124"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6875297"
+editedAt: DateTimeImmutable @1707737027 {#4169
date: 2024-02-12 12:23:47.0 +01:00
}
+createdAt: DateTimeImmutable @1703524389 {#4167
date: 2023-12-25 18:13:09.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> nowadays egrep is not recommended to use. grep -E is a more portable synonim\n
\n
Not directed at you personally, but this is the kind of pointless pedantry from upstream developers that grinds my gears.\n
\n
Like, I’ve used `egrep` for 25 years. I don’t know of a still relevant Unix variant in existence that doesn’t have the `egrep` command. But suddenly now, when any other Unix variant but Linux is all but extinct, and all your shell scripts are probably full of bashisms and Linuxisms anyway, *now* there is somehow a portability problem, and they deem it necessary to print out a warning whenever I dare to run `egrep` instead of `grep -E`? C’mon now … If anything, they have just made it *less* portable by spitting out spurious warnings where there weren’t any before.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 8
+score: 0
+lastActive: DateTime @1703590646 {#5423
date: 2023-12-26 12:37:26.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
]
+children: Doctrine\ORM\PersistentCollection {#5427 …}
+nested: Doctrine\ORM\PersistentCollection {#5429 …}
+votes: Doctrine\ORM\PersistentCollection {#5431 …}
+reports: Doctrine\ORM\PersistentCollection {#5433 …}
+favourites: Doctrine\ORM\PersistentCollection {#5435 …}
+notifications: Doctrine\ORM\PersistentCollection {#5437 …}
-id: 253349
-bodyTs: "'25':41 'anyth':120 'anyway':88 'bashism':85 'c':116 'command':61 'dare':108 'deem':98 'develop':30 'direct':16 'doesn':56 'e':9,115 'egrep':2,39,60,111 'exist':54 'extinct':75 'full':83 'gear':34 'grep':8,114 'grind':32 'instead':112 'kind':24 'know':46 'less':126 'like':35 'linux':71,87 'made':124 'mon':117 'necessari':100 'nowaday':1 'pedantri':27 'person':19 'pointless':26 'portabl':13,94,127 'print':102 'probabl':82 'problem':95 'recommend':5 'relev':50 'run':110 'script':80 'shell':79 'somehow':92 'spit':129 'spurious':131 'still':49 'sudden':63 'synonim':14 'unix':51,68 'upstream':29 'use':7,38 'variant':52,69 've':37 'warn':105,132 'weren':135 'whenev':106 'year':42"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5573914"
+editedAt: null
+createdAt: DateTimeImmutable @1703590646 {#5424
date: 2023-12-26 12:37:26.0 +01:00
}
} |
|
Show voter details
|
| 15 |
DENIED
|
edit
|
App\Entity\EntryComment {#5425
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4163
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
It is a great book, although a bit outdated. In particular, nowadays `egrep` is not recommended to use. `grep -E` is a more portable synonim.\n
\n
Some notes on you script:\n
\n
1. You don’t need to escape slashes in grep regex. In the sed `s///` command better use another character like `s###` so you also can leave slashes unescaped.\n
2. You usually don’t need to pipe `grep` and `sed`, `sed -n` with regex address and explicit printing command gives the same result as `grep`.\n
3. You could omit leading slash in your `egrep` regex, so you won’t need to remove it later.\n
\n
So I would do the same with\n
\n
```\n
\n
<span style="color:#323232;">tar -tzvf file.tar.gz | sed -En '/.(mp4|mkv)$/{s#^.*/##; s#.[.*##; s#[^a-zA-Z0-9()&-]# #g; s/ +/ /g; p}'\n
</span>\n
```
"""
+lang: "en"
+isAdult: false
+favouriteCount: 14
+score: 0
+lastActive: DateTime @1708114193 {#4164
date: 2024-02-16 21:09:53.0 +01:00
}
+ip: null
+tags: [
"323232"
]
+mentions: [
"@harsh3466@lemmy.world"
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4161 …}
+nested: Doctrine\ORM\PersistentCollection {#4159 …}
+votes: Doctrine\ORM\PersistentCollection {#4157 …}
+reports: Doctrine\ORM\PersistentCollection {#4154 …}
+favourites: Doctrine\ORM\PersistentCollection {#4150 …}
+notifications: Doctrine\ORM\PersistentCollection {#4148 …}
-id: 251438
-bodyTs: "'/g':129 '1':31 '2':60 '3':86 '9':126 'a-za-z0':122 'address':75 'also':55 'although':6 'anoth':49 'better':47 'bit':8 'book':5 'charact':50 'command':46,79 'could':88 'e':20 'egrep':13,94 'en':116 'escap':37 'explicit':77 'file.tar.gz':114 'g':127 'give':80 'great':4 'grep':19,40,68,85 'later':104 'lead':90 'leav':57 'like':51 'mkv':118 'mp4':117 'n':72 'need':35,65,100 'note':27 'nowaday':12 'omit':89 'outdat':9 'p':130 'particular':11 'pipe':67 'portabl':24 'print':78 'recommend':16 'regex':41,74,95 'remov':102 'result':83 'script':30 'sed':44,70,71,115 'slash':38,58,91 'synonim':25 'tar':112 'tzvf':113 'unescap':59 'use':18,48 'usual':62 'won':98 'would':107 'z0':125 'za':124"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6875297"
+editedAt: DateTimeImmutable @1707737027 {#4169
date: 2024-02-12 12:23:47.0 +01:00
}
+createdAt: DateTimeImmutable @1703524389 {#4167
date: 2023-12-25 18:13:09.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> nowadays egrep is not recommended to use. grep -E is a more portable synonim\n
\n
Not directed at you personally, but this is the kind of pointless pedantry from upstream developers that grinds my gears.\n
\n
Like, I’ve used `egrep` for 25 years. I don’t know of a still relevant Unix variant in existence that doesn’t have the `egrep` command. But suddenly now, when any other Unix variant but Linux is all but extinct, and all your shell scripts are probably full of bashisms and Linuxisms anyway, *now* there is somehow a portability problem, and they deem it necessary to print out a warning whenever I dare to run `egrep` instead of `grep -E`? C’mon now … If anything, they have just made it *less* portable by spitting out spurious warnings where there weren’t any before.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 8
+score: 0
+lastActive: DateTime @1703590646 {#5423
date: 2023-12-26 12:37:26.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
]
+children: Doctrine\ORM\PersistentCollection {#5427 …}
+nested: Doctrine\ORM\PersistentCollection {#5429 …}
+votes: Doctrine\ORM\PersistentCollection {#5431 …}
+reports: Doctrine\ORM\PersistentCollection {#5433 …}
+favourites: Doctrine\ORM\PersistentCollection {#5435 …}
+notifications: Doctrine\ORM\PersistentCollection {#5437 …}
-id: 253349
-bodyTs: "'25':41 'anyth':120 'anyway':88 'bashism':85 'c':116 'command':61 'dare':108 'deem':98 'develop':30 'direct':16 'doesn':56 'e':9,115 'egrep':2,39,60,111 'exist':54 'extinct':75 'full':83 'gear':34 'grep':8,114 'grind':32 'instead':112 'kind':24 'know':46 'less':126 'like':35 'linux':71,87 'made':124 'mon':117 'necessari':100 'nowaday':1 'pedantri':27 'person':19 'pointless':26 'portabl':13,94,127 'print':102 'probabl':82 'problem':95 'recommend':5 'relev':50 'run':110 'script':80 'shell':79 'somehow':92 'spit':129 'spurious':131 'still':49 'sudden':63 'synonim':14 'unix':51,68 'upstream':29 'use':7,38 'variant':52,69 've':37 'warn':105,132 'weren':135 'whenev':106 'year':42"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5573914"
+editedAt: null
+createdAt: DateTimeImmutable @1703590646 {#5424
date: 2023-12-26 12:37:26.0 +01:00
}
} |
|
Show voter details
|
| 16 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5425
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4163
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
It is a great book, although a bit outdated. In particular, nowadays `egrep` is not recommended to use. `grep -E` is a more portable synonim.\n
\n
Some notes on you script:\n
\n
1. You don’t need to escape slashes in grep regex. In the sed `s///` command better use another character like `s###` so you also can leave slashes unescaped.\n
2. You usually don’t need to pipe `grep` and `sed`, `sed -n` with regex address and explicit printing command gives the same result as `grep`.\n
3. You could omit leading slash in your `egrep` regex, so you won’t need to remove it later.\n
\n
So I would do the same with\n
\n
```\n
\n
<span style="color:#323232;">tar -tzvf file.tar.gz | sed -En '/.(mp4|mkv)$/{s#^.*/##; s#.[.*##; s#[^a-zA-Z0-9()&-]# #g; s/ +/ /g; p}'\n
</span>\n
```
"""
+lang: "en"
+isAdult: false
+favouriteCount: 14
+score: 0
+lastActive: DateTime @1708114193 {#4164
date: 2024-02-16 21:09:53.0 +01:00
}
+ip: null
+tags: [
"323232"
]
+mentions: [
"@harsh3466@lemmy.world"
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4161 …}
+nested: Doctrine\ORM\PersistentCollection {#4159 …}
+votes: Doctrine\ORM\PersistentCollection {#4157 …}
+reports: Doctrine\ORM\PersistentCollection {#4154 …}
+favourites: Doctrine\ORM\PersistentCollection {#4150 …}
+notifications: Doctrine\ORM\PersistentCollection {#4148 …}
-id: 251438
-bodyTs: "'/g':129 '1':31 '2':60 '3':86 '9':126 'a-za-z0':122 'address':75 'also':55 'although':6 'anoth':49 'better':47 'bit':8 'book':5 'charact':50 'command':46,79 'could':88 'e':20 'egrep':13,94 'en':116 'escap':37 'explicit':77 'file.tar.gz':114 'g':127 'give':80 'great':4 'grep':19,40,68,85 'later':104 'lead':90 'leav':57 'like':51 'mkv':118 'mp4':117 'n':72 'need':35,65,100 'note':27 'nowaday':12 'omit':89 'outdat':9 'p':130 'particular':11 'pipe':67 'portabl':24 'print':78 'recommend':16 'regex':41,74,95 'remov':102 'result':83 'script':30 'sed':44,70,71,115 'slash':38,58,91 'synonim':25 'tar':112 'tzvf':113 'unescap':59 'use':18,48 'usual':62 'won':98 'would':107 'z0':125 'za':124"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6875297"
+editedAt: DateTimeImmutable @1707737027 {#4169
date: 2024-02-12 12:23:47.0 +01:00
}
+createdAt: DateTimeImmutable @1703524389 {#4167
date: 2023-12-25 18:13:09.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> nowadays egrep is not recommended to use. grep -E is a more portable synonim\n
\n
Not directed at you personally, but this is the kind of pointless pedantry from upstream developers that grinds my gears.\n
\n
Like, I’ve used `egrep` for 25 years. I don’t know of a still relevant Unix variant in existence that doesn’t have the `egrep` command. But suddenly now, when any other Unix variant but Linux is all but extinct, and all your shell scripts are probably full of bashisms and Linuxisms anyway, *now* there is somehow a portability problem, and they deem it necessary to print out a warning whenever I dare to run `egrep` instead of `grep -E`? C’mon now … If anything, they have just made it *less* portable by spitting out spurious warnings where there weren’t any before.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 8
+score: 0
+lastActive: DateTime @1703590646 {#5423
date: 2023-12-26 12:37:26.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
]
+children: Doctrine\ORM\PersistentCollection {#5427 …}
+nested: Doctrine\ORM\PersistentCollection {#5429 …}
+votes: Doctrine\ORM\PersistentCollection {#5431 …}
+reports: Doctrine\ORM\PersistentCollection {#5433 …}
+favourites: Doctrine\ORM\PersistentCollection {#5435 …}
+notifications: Doctrine\ORM\PersistentCollection {#5437 …}
-id: 253349
-bodyTs: "'25':41 'anyth':120 'anyway':88 'bashism':85 'c':116 'command':61 'dare':108 'deem':98 'develop':30 'direct':16 'doesn':56 'e':9,115 'egrep':2,39,60,111 'exist':54 'extinct':75 'full':83 'gear':34 'grep':8,114 'grind':32 'instead':112 'kind':24 'know':46 'less':126 'like':35 'linux':71,87 'made':124 'mon':117 'necessari':100 'nowaday':1 'pedantri':27 'person':19 'pointless':26 'portabl':13,94,127 'print':102 'probabl':82 'problem':95 'recommend':5 'relev':50 'run':110 'script':80 'shell':79 'somehow':92 'spit':129 'spurious':131 'still':49 'sudden':63 'synonim':14 'unix':51,68 'upstream':29 'use':7,38 'variant':52,69 've':37 'warn':105,132 'weren':135 'whenev':106 'year':42"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5573914"
+editedAt: null
+createdAt: DateTimeImmutable @1703590646 {#5424
date: 2023-12-26 12:37:26.0 +01:00
}
} |
|
Show voter details
|
| 17 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 18 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5510
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5425
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4163
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
It is a great book, although a bit outdated. In particular, nowadays `egrep` is not recommended to use. `grep -E` is a more portable synonim.\n
\n
Some notes on you script:\n
\n
1. You don’t need to escape slashes in grep regex. In the sed `s///` command better use another character like `s###` so you also can leave slashes unescaped.\n
2. You usually don’t need to pipe `grep` and `sed`, `sed -n` with regex address and explicit printing command gives the same result as `grep`.\n
3. You could omit leading slash in your `egrep` regex, so you won’t need to remove it later.\n
\n
So I would do the same with\n
\n
```\n
\n
<span style="color:#323232;">tar -tzvf file.tar.gz | sed -En '/.(mp4|mkv)$/{s#^.*/##; s#.[.*##; s#[^a-zA-Z0-9()&-]# #g; s/ +/ /g; p}'\n
</span>\n
```
"""
+lang: "en"
+isAdult: false
+favouriteCount: 14
+score: 0
+lastActive: DateTime @1708114193 {#4164
date: 2024-02-16 21:09:53.0 +01:00
}
+ip: null
+tags: [
"323232"
]
+mentions: [
"@harsh3466@lemmy.world"
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4161 …}
+nested: Doctrine\ORM\PersistentCollection {#4159 …}
+votes: Doctrine\ORM\PersistentCollection {#4157 …}
+reports: Doctrine\ORM\PersistentCollection {#4154 …}
+favourites: Doctrine\ORM\PersistentCollection {#4150 …}
+notifications: Doctrine\ORM\PersistentCollection {#4148 …}
-id: 251438
-bodyTs: "'/g':129 '1':31 '2':60 '3':86 '9':126 'a-za-z0':122 'address':75 'also':55 'although':6 'anoth':49 'better':47 'bit':8 'book':5 'charact':50 'command':46,79 'could':88 'e':20 'egrep':13,94 'en':116 'escap':37 'explicit':77 'file.tar.gz':114 'g':127 'give':80 'great':4 'grep':19,40,68,85 'later':104 'lead':90 'leav':57 'like':51 'mkv':118 'mp4':117 'n':72 'need':35,65,100 'note':27 'nowaday':12 'omit':89 'outdat':9 'p':130 'particular':11 'pipe':67 'portabl':24 'print':78 'recommend':16 'regex':41,74,95 'remov':102 'result':83 'script':30 'sed':44,70,71,115 'slash':38,58,91 'synonim':25 'tar':112 'tzvf':113 'unescap':59 'use':18,48 'usual':62 'won':98 'would':107 'z0':125 'za':124"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6875297"
+editedAt: DateTimeImmutable @1707737027 {#4169
date: 2024-02-12 12:23:47.0 +01:00
}
+createdAt: DateTimeImmutable @1703524389 {#4167
date: 2023-12-25 18:13:09.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> nowadays egrep is not recommended to use. grep -E is a more portable synonim\n
\n
Not directed at you personally, but this is the kind of pointless pedantry from upstream developers that grinds my gears.\n
\n
Like, I’ve used `egrep` for 25 years. I don’t know of a still relevant Unix variant in existence that doesn’t have the `egrep` command. But suddenly now, when any other Unix variant but Linux is all but extinct, and all your shell scripts are probably full of bashisms and Linuxisms anyway, *now* there is somehow a portability problem, and they deem it necessary to print out a warning whenever I dare to run `egrep` instead of `grep -E`? C’mon now … If anything, they have just made it *less* portable by spitting out spurious warnings where there weren’t any before.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 8
+score: 0
+lastActive: DateTime @1703590646 {#5423
date: 2023-12-26 12:37:26.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
]
+children: Doctrine\ORM\PersistentCollection {#5427 …}
+nested: Doctrine\ORM\PersistentCollection {#5429 …}
+votes: Doctrine\ORM\PersistentCollection {#5431 …}
+reports: Doctrine\ORM\PersistentCollection {#5433 …}
+favourites: Doctrine\ORM\PersistentCollection {#5435 …}
+notifications: Doctrine\ORM\PersistentCollection {#5437 …}
-id: 253349
-bodyTs: "'25':41 'anyth':120 'anyway':88 'bashism':85 'c':116 'command':61 'dare':108 'deem':98 'develop':30 'direct':16 'doesn':56 'e':9,115 'egrep':2,39,60,111 'exist':54 'extinct':75 'full':83 'gear':34 'grep':8,114 'grind':32 'instead':112 'kind':24 'know':46 'less':126 'like':35 'linux':71,87 'made':124 'mon':117 'necessari':100 'nowaday':1 'pedantri':27 'person':19 'pointless':26 'portabl':13,94,127 'print':102 'probabl':82 'problem':95 'recommend':5 'relev':50 'run':110 'script':80 'shell':79 'somehow':92 'spit':129 'spurious':131 'still':49 'sudden':63 'synonim':14 'unix':51,68 'upstream':29 'use':7,38 'variant':52,69 've':37 'warn':105,132 'weren':135 'whenev':106 'year':42"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5573914"
+editedAt: null
+createdAt: DateTimeImmutable @1703590646 {#5424
date: 2023-12-26 12:37:26.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
GNU grep, the most widespread implementation, does not include `egrep`, `fgrep` and `rgrep` for years. Distributions (not all, but many) provide shell scripts that simply run `grep` with corresponding option for backward compatibility. You can learn this from official documentation.\n
\n
Also, *my* scripts are not full of bashisms, gnuisms, linuxisms and other -isms, I try to keep them portable unless it is really necessary to use some unportable command or syntax.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703613068 {#5508
date: 2023-12-26 18:51:08.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5511 …}
+nested: Doctrine\ORM\PersistentCollection {#5513 …}
+votes: Doctrine\ORM\PersistentCollection {#5515 …}
+reports: Doctrine\ORM\PersistentCollection {#5517 …}
+favourites: Doctrine\ORM\PersistentCollection {#5519 …}
+notifications: Doctrine\ORM\PersistentCollection {#5521 …}
-id: 254226
-bodyTs: "'also':41 'backward':32 'bashism':48 'command':69 'compat':33 'correspond':29 'distribut':16 'document':40 'egrep':10 'fgrep':11 'full':46 'gnu':1 'gnuism':49 'grep':2,27 'implement':6 'includ':9 'ism':53 'keep':57 'learn':36 'linux':50 'mani':20 'necessari':64 'offici':39 'option':30 'portabl':59 'provid':21 'realli':63 'rgrep':13 'run':26 'script':23,43 'shell':22 'simpli':25 'syntax':71 'tri':55 'unless':60 'unport':68 'use':66 'widespread':5 'year':15"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6891772"
+editedAt: null
+createdAt: DateTimeImmutable @1703613068 {#5509
date: 2023-12-26 18:51:08.0 +01:00
}
} |
|
Show voter details
|
| 19 |
DENIED
|
edit
|
App\Entity\EntryComment {#5510
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5425
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4163
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
It is a great book, although a bit outdated. In particular, nowadays `egrep` is not recommended to use. `grep -E` is a more portable synonim.\n
\n
Some notes on you script:\n
\n
1. You don’t need to escape slashes in grep regex. In the sed `s///` command better use another character like `s###` so you also can leave slashes unescaped.\n
2. You usually don’t need to pipe `grep` and `sed`, `sed -n` with regex address and explicit printing command gives the same result as `grep`.\n
3. You could omit leading slash in your `egrep` regex, so you won’t need to remove it later.\n
\n
So I would do the same with\n
\n
```\n
\n
<span style="color:#323232;">tar -tzvf file.tar.gz | sed -En '/.(mp4|mkv)$/{s#^.*/##; s#.[.*##; s#[^a-zA-Z0-9()&-]# #g; s/ +/ /g; p}'\n
</span>\n
```
"""
+lang: "en"
+isAdult: false
+favouriteCount: 14
+score: 0
+lastActive: DateTime @1708114193 {#4164
date: 2024-02-16 21:09:53.0 +01:00
}
+ip: null
+tags: [
"323232"
]
+mentions: [
"@harsh3466@lemmy.world"
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4161 …}
+nested: Doctrine\ORM\PersistentCollection {#4159 …}
+votes: Doctrine\ORM\PersistentCollection {#4157 …}
+reports: Doctrine\ORM\PersistentCollection {#4154 …}
+favourites: Doctrine\ORM\PersistentCollection {#4150 …}
+notifications: Doctrine\ORM\PersistentCollection {#4148 …}
-id: 251438
-bodyTs: "'/g':129 '1':31 '2':60 '3':86 '9':126 'a-za-z0':122 'address':75 'also':55 'although':6 'anoth':49 'better':47 'bit':8 'book':5 'charact':50 'command':46,79 'could':88 'e':20 'egrep':13,94 'en':116 'escap':37 'explicit':77 'file.tar.gz':114 'g':127 'give':80 'great':4 'grep':19,40,68,85 'later':104 'lead':90 'leav':57 'like':51 'mkv':118 'mp4':117 'n':72 'need':35,65,100 'note':27 'nowaday':12 'omit':89 'outdat':9 'p':130 'particular':11 'pipe':67 'portabl':24 'print':78 'recommend':16 'regex':41,74,95 'remov':102 'result':83 'script':30 'sed':44,70,71,115 'slash':38,58,91 'synonim':25 'tar':112 'tzvf':113 'unescap':59 'use':18,48 'usual':62 'won':98 'would':107 'z0':125 'za':124"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6875297"
+editedAt: DateTimeImmutable @1707737027 {#4169
date: 2024-02-12 12:23:47.0 +01:00
}
+createdAt: DateTimeImmutable @1703524389 {#4167
date: 2023-12-25 18:13:09.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> nowadays egrep is not recommended to use. grep -E is a more portable synonim\n
\n
Not directed at you personally, but this is the kind of pointless pedantry from upstream developers that grinds my gears.\n
\n
Like, I’ve used `egrep` for 25 years. I don’t know of a still relevant Unix variant in existence that doesn’t have the `egrep` command. But suddenly now, when any other Unix variant but Linux is all but extinct, and all your shell scripts are probably full of bashisms and Linuxisms anyway, *now* there is somehow a portability problem, and they deem it necessary to print out a warning whenever I dare to run `egrep` instead of `grep -E`? C’mon now … If anything, they have just made it *less* portable by spitting out spurious warnings where there weren’t any before.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 8
+score: 0
+lastActive: DateTime @1703590646 {#5423
date: 2023-12-26 12:37:26.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
]
+children: Doctrine\ORM\PersistentCollection {#5427 …}
+nested: Doctrine\ORM\PersistentCollection {#5429 …}
+votes: Doctrine\ORM\PersistentCollection {#5431 …}
+reports: Doctrine\ORM\PersistentCollection {#5433 …}
+favourites: Doctrine\ORM\PersistentCollection {#5435 …}
+notifications: Doctrine\ORM\PersistentCollection {#5437 …}
-id: 253349
-bodyTs: "'25':41 'anyth':120 'anyway':88 'bashism':85 'c':116 'command':61 'dare':108 'deem':98 'develop':30 'direct':16 'doesn':56 'e':9,115 'egrep':2,39,60,111 'exist':54 'extinct':75 'full':83 'gear':34 'grep':8,114 'grind':32 'instead':112 'kind':24 'know':46 'less':126 'like':35 'linux':71,87 'made':124 'mon':117 'necessari':100 'nowaday':1 'pedantri':27 'person':19 'pointless':26 'portabl':13,94,127 'print':102 'probabl':82 'problem':95 'recommend':5 'relev':50 'run':110 'script':80 'shell':79 'somehow':92 'spit':129 'spurious':131 'still':49 'sudden':63 'synonim':14 'unix':51,68 'upstream':29 'use':7,38 'variant':52,69 've':37 'warn':105,132 'weren':135 'whenev':106 'year':42"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5573914"
+editedAt: null
+createdAt: DateTimeImmutable @1703590646 {#5424
date: 2023-12-26 12:37:26.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
GNU grep, the most widespread implementation, does not include `egrep`, `fgrep` and `rgrep` for years. Distributions (not all, but many) provide shell scripts that simply run `grep` with corresponding option for backward compatibility. You can learn this from official documentation.\n
\n
Also, *my* scripts are not full of bashisms, gnuisms, linuxisms and other -isms, I try to keep them portable unless it is really necessary to use some unportable command or syntax.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703613068 {#5508
date: 2023-12-26 18:51:08.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5511 …}
+nested: Doctrine\ORM\PersistentCollection {#5513 …}
+votes: Doctrine\ORM\PersistentCollection {#5515 …}
+reports: Doctrine\ORM\PersistentCollection {#5517 …}
+favourites: Doctrine\ORM\PersistentCollection {#5519 …}
+notifications: Doctrine\ORM\PersistentCollection {#5521 …}
-id: 254226
-bodyTs: "'also':41 'backward':32 'bashism':48 'command':69 'compat':33 'correspond':29 'distribut':16 'document':40 'egrep':10 'fgrep':11 'full':46 'gnu':1 'gnuism':49 'grep':2,27 'implement':6 'includ':9 'ism':53 'keep':57 'learn':36 'linux':50 'mani':20 'necessari':64 'offici':39 'option':30 'portabl':59 'provid':21 'realli':63 'rgrep':13 'run':26 'script':23,43 'shell':22 'simpli':25 'syntax':71 'tri':55 'unless':60 'unport':68 'use':66 'widespread':5 'year':15"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6891772"
+editedAt: null
+createdAt: DateTimeImmutable @1703613068 {#5509
date: 2023-12-26 18:51:08.0 +01:00
}
} |
|
Show voter details
|
| 20 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5510
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5425
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4163
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
It is a great book, although a bit outdated. In particular, nowadays `egrep` is not recommended to use. `grep -E` is a more portable synonim.\n
\n
Some notes on you script:\n
\n
1. You don’t need to escape slashes in grep regex. In the sed `s///` command better use another character like `s###` so you also can leave slashes unescaped.\n
2. You usually don’t need to pipe `grep` and `sed`, `sed -n` with regex address and explicit printing command gives the same result as `grep`.\n
3. You could omit leading slash in your `egrep` regex, so you won’t need to remove it later.\n
\n
So I would do the same with\n
\n
```\n
\n
<span style="color:#323232;">tar -tzvf file.tar.gz | sed -En '/.(mp4|mkv)$/{s#^.*/##; s#.[.*##; s#[^a-zA-Z0-9()&-]# #g; s/ +/ /g; p}'\n
</span>\n
```
"""
+lang: "en"
+isAdult: false
+favouriteCount: 14
+score: 0
+lastActive: DateTime @1708114193 {#4164
date: 2024-02-16 21:09:53.0 +01:00
}
+ip: null
+tags: [
"323232"
]
+mentions: [
"@harsh3466@lemmy.world"
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4161 …}
+nested: Doctrine\ORM\PersistentCollection {#4159 …}
+votes: Doctrine\ORM\PersistentCollection {#4157 …}
+reports: Doctrine\ORM\PersistentCollection {#4154 …}
+favourites: Doctrine\ORM\PersistentCollection {#4150 …}
+notifications: Doctrine\ORM\PersistentCollection {#4148 …}
-id: 251438
-bodyTs: "'/g':129 '1':31 '2':60 '3':86 '9':126 'a-za-z0':122 'address':75 'also':55 'although':6 'anoth':49 'better':47 'bit':8 'book':5 'charact':50 'command':46,79 'could':88 'e':20 'egrep':13,94 'en':116 'escap':37 'explicit':77 'file.tar.gz':114 'g':127 'give':80 'great':4 'grep':19,40,68,85 'later':104 'lead':90 'leav':57 'like':51 'mkv':118 'mp4':117 'n':72 'need':35,65,100 'note':27 'nowaday':12 'omit':89 'outdat':9 'p':130 'particular':11 'pipe':67 'portabl':24 'print':78 'recommend':16 'regex':41,74,95 'remov':102 'result':83 'script':30 'sed':44,70,71,115 'slash':38,58,91 'synonim':25 'tar':112 'tzvf':113 'unescap':59 'use':18,48 'usual':62 'won':98 'would':107 'z0':125 'za':124"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6875297"
+editedAt: DateTimeImmutable @1707737027 {#4169
date: 2024-02-12 12:23:47.0 +01:00
}
+createdAt: DateTimeImmutable @1703524389 {#4167
date: 2023-12-25 18:13:09.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> nowadays egrep is not recommended to use. grep -E is a more portable synonim\n
\n
Not directed at you personally, but this is the kind of pointless pedantry from upstream developers that grinds my gears.\n
\n
Like, I’ve used `egrep` for 25 years. I don’t know of a still relevant Unix variant in existence that doesn’t have the `egrep` command. But suddenly now, when any other Unix variant but Linux is all but extinct, and all your shell scripts are probably full of bashisms and Linuxisms anyway, *now* there is somehow a portability problem, and they deem it necessary to print out a warning whenever I dare to run `egrep` instead of `grep -E`? C’mon now … If anything, they have just made it *less* portable by spitting out spurious warnings where there weren’t any before.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 8
+score: 0
+lastActive: DateTime @1703590646 {#5423
date: 2023-12-26 12:37:26.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
]
+children: Doctrine\ORM\PersistentCollection {#5427 …}
+nested: Doctrine\ORM\PersistentCollection {#5429 …}
+votes: Doctrine\ORM\PersistentCollection {#5431 …}
+reports: Doctrine\ORM\PersistentCollection {#5433 …}
+favourites: Doctrine\ORM\PersistentCollection {#5435 …}
+notifications: Doctrine\ORM\PersistentCollection {#5437 …}
-id: 253349
-bodyTs: "'25':41 'anyth':120 'anyway':88 'bashism':85 'c':116 'command':61 'dare':108 'deem':98 'develop':30 'direct':16 'doesn':56 'e':9,115 'egrep':2,39,60,111 'exist':54 'extinct':75 'full':83 'gear':34 'grep':8,114 'grind':32 'instead':112 'kind':24 'know':46 'less':126 'like':35 'linux':71,87 'made':124 'mon':117 'necessari':100 'nowaday':1 'pedantri':27 'person':19 'pointless':26 'portabl':13,94,127 'print':102 'probabl':82 'problem':95 'recommend':5 'relev':50 'run':110 'script':80 'shell':79 'somehow':92 'spit':129 'spurious':131 'still':49 'sudden':63 'synonim':14 'unix':51,68 'upstream':29 'use':7,38 'variant':52,69 've':37 'warn':105,132 'weren':135 'whenev':106 'year':42"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5573914"
+editedAt: null
+createdAt: DateTimeImmutable @1703590646 {#5424
date: 2023-12-26 12:37:26.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
GNU grep, the most widespread implementation, does not include `egrep`, `fgrep` and `rgrep` for years. Distributions (not all, but many) provide shell scripts that simply run `grep` with corresponding option for backward compatibility. You can learn this from official documentation.\n
\n
Also, *my* scripts are not full of bashisms, gnuisms, linuxisms and other -isms, I try to keep them portable unless it is really necessary to use some unportable command or syntax.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703613068 {#5508
date: 2023-12-26 18:51:08.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5511 …}
+nested: Doctrine\ORM\PersistentCollection {#5513 …}
+votes: Doctrine\ORM\PersistentCollection {#5515 …}
+reports: Doctrine\ORM\PersistentCollection {#5517 …}
+favourites: Doctrine\ORM\PersistentCollection {#5519 …}
+notifications: Doctrine\ORM\PersistentCollection {#5521 …}
-id: 254226
-bodyTs: "'also':41 'backward':32 'bashism':48 'command':69 'compat':33 'correspond':29 'distribut':16 'document':40 'egrep':10 'fgrep':11 'full':46 'gnu':1 'gnuism':49 'grep':2,27 'implement':6 'includ':9 'ism':53 'keep':57 'learn':36 'linux':50 'mani':20 'necessari':64 'offici':39 'option':30 'portabl':59 'provid':21 'realli':63 'rgrep':13 'run':26 'script':23,43 'shell':22 'simpli':25 'syntax':71 'tri':55 'unless':60 'unport':68 'use':66 'widespread':5 'year':15"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6891772"
+editedAt: null
+createdAt: DateTimeImmutable @1703613068 {#5509
date: 2023-12-26 18:51:08.0 +01:00
}
} |
|
Show voter details
|
| 21 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 22 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5548
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5510
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5425
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4163
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
It is a great book, although a bit outdated. In particular, nowadays `egrep` is not recommended to use. `grep -E` is a more portable synonim.\n
\n
Some notes on you script:\n
\n
1. You don’t need to escape slashes in grep regex. In the sed `s///` command better use another character like `s###` so you also can leave slashes unescaped.\n
2. You usually don’t need to pipe `grep` and `sed`, `sed -n` with regex address and explicit printing command gives the same result as `grep`.\n
3. You could omit leading slash in your `egrep` regex, so you won’t need to remove it later.\n
\n
So I would do the same with\n
\n
```\n
\n
<span style="color:#323232;">tar -tzvf file.tar.gz | sed -En '/.(mp4|mkv)$/{s#^.*/##; s#.[.*##; s#[^a-zA-Z0-9()&-]# #g; s/ +/ /g; p}'\n
</span>\n
```
"""
+lang: "en"
+isAdult: false
+favouriteCount: 14
+score: 0
+lastActive: DateTime @1708114193 {#4164
date: 2024-02-16 21:09:53.0 +01:00
}
+ip: null
+tags: [
"323232"
]
+mentions: [
"@harsh3466@lemmy.world"
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4161 …}
+nested: Doctrine\ORM\PersistentCollection {#4159 …}
+votes: Doctrine\ORM\PersistentCollection {#4157 …}
+reports: Doctrine\ORM\PersistentCollection {#4154 …}
+favourites: Doctrine\ORM\PersistentCollection {#4150 …}
+notifications: Doctrine\ORM\PersistentCollection {#4148 …}
-id: 251438
-bodyTs: "'/g':129 '1':31 '2':60 '3':86 '9':126 'a-za-z0':122 'address':75 'also':55 'although':6 'anoth':49 'better':47 'bit':8 'book':5 'charact':50 'command':46,79 'could':88 'e':20 'egrep':13,94 'en':116 'escap':37 'explicit':77 'file.tar.gz':114 'g':127 'give':80 'great':4 'grep':19,40,68,85 'later':104 'lead':90 'leav':57 'like':51 'mkv':118 'mp4':117 'n':72 'need':35,65,100 'note':27 'nowaday':12 'omit':89 'outdat':9 'p':130 'particular':11 'pipe':67 'portabl':24 'print':78 'recommend':16 'regex':41,74,95 'remov':102 'result':83 'script':30 'sed':44,70,71,115 'slash':38,58,91 'synonim':25 'tar':112 'tzvf':113 'unescap':59 'use':18,48 'usual':62 'won':98 'would':107 'z0':125 'za':124"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6875297"
+editedAt: DateTimeImmutable @1707737027 {#4169
date: 2024-02-12 12:23:47.0 +01:00
}
+createdAt: DateTimeImmutable @1703524389 {#4167
date: 2023-12-25 18:13:09.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> nowadays egrep is not recommended to use. grep -E is a more portable synonim\n
\n
Not directed at you personally, but this is the kind of pointless pedantry from upstream developers that grinds my gears.\n
\n
Like, I’ve used `egrep` for 25 years. I don’t know of a still relevant Unix variant in existence that doesn’t have the `egrep` command. But suddenly now, when any other Unix variant but Linux is all but extinct, and all your shell scripts are probably full of bashisms and Linuxisms anyway, *now* there is somehow a portability problem, and they deem it necessary to print out a warning whenever I dare to run `egrep` instead of `grep -E`? C’mon now … If anything, they have just made it *less* portable by spitting out spurious warnings where there weren’t any before.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 8
+score: 0
+lastActive: DateTime @1703590646 {#5423
date: 2023-12-26 12:37:26.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
]
+children: Doctrine\ORM\PersistentCollection {#5427 …}
+nested: Doctrine\ORM\PersistentCollection {#5429 …}
+votes: Doctrine\ORM\PersistentCollection {#5431 …}
+reports: Doctrine\ORM\PersistentCollection {#5433 …}
+favourites: Doctrine\ORM\PersistentCollection {#5435 …}
+notifications: Doctrine\ORM\PersistentCollection {#5437 …}
-id: 253349
-bodyTs: "'25':41 'anyth':120 'anyway':88 'bashism':85 'c':116 'command':61 'dare':108 'deem':98 'develop':30 'direct':16 'doesn':56 'e':9,115 'egrep':2,39,60,111 'exist':54 'extinct':75 'full':83 'gear':34 'grep':8,114 'grind':32 'instead':112 'kind':24 'know':46 'less':126 'like':35 'linux':71,87 'made':124 'mon':117 'necessari':100 'nowaday':1 'pedantri':27 'person':19 'pointless':26 'portabl':13,94,127 'print':102 'probabl':82 'problem':95 'recommend':5 'relev':50 'run':110 'script':80 'shell':79 'somehow':92 'spit':129 'spurious':131 'still':49 'sudden':63 'synonim':14 'unix':51,68 'upstream':29 'use':7,38 'variant':52,69 've':37 'warn':105,132 'weren':135 'whenev':106 'year':42"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5573914"
+editedAt: null
+createdAt: DateTimeImmutable @1703590646 {#5424
date: 2023-12-26 12:37:26.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
GNU grep, the most widespread implementation, does not include `egrep`, `fgrep` and `rgrep` for years. Distributions (not all, but many) provide shell scripts that simply run `grep` with corresponding option for backward compatibility. You can learn this from official documentation.\n
\n
Also, *my* scripts are not full of bashisms, gnuisms, linuxisms and other -isms, I try to keep them portable unless it is really necessary to use some unportable command or syntax.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703613068 {#5508
date: 2023-12-26 18:51:08.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5511 …}
+nested: Doctrine\ORM\PersistentCollection {#5513 …}
+votes: Doctrine\ORM\PersistentCollection {#5515 …}
+reports: Doctrine\ORM\PersistentCollection {#5517 …}
+favourites: Doctrine\ORM\PersistentCollection {#5519 …}
+notifications: Doctrine\ORM\PersistentCollection {#5521 …}
-id: 254226
-bodyTs: "'also':41 'backward':32 'bashism':48 'command':69 'compat':33 'correspond':29 'distribut':16 'document':40 'egrep':10 'fgrep':11 'full':46 'gnu':1 'gnuism':49 'grep':2,27 'implement':6 'includ':9 'ism':53 'keep':57 'learn':36 'linux':50 'mani':20 'necessari':64 'offici':39 'option':30 'portabl':59 'provid':21 'realli':63 'rgrep':13 'run':26 'script':23,43 'shell':22 'simpli':25 'syntax':71 'tri':55 'unless':60 'unport':68 'use':66 'widespread':5 'year':15"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6891772"
+editedAt: null
+createdAt: DateTimeImmutable @1703613068 {#5509
date: 2023-12-26 18:51:08.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> GNU grep, the most widespread implementation, does not include egrep, fgrep and rgrep for years. Distributions (not all, but many) provide shell scripts that simply run grep with corresponding option for backward compatibility. You can learn this from official documentation.\n
\n
It seems you need to read the official documentation yourself. While it’s new information to me that `egrep` is no longer a symlink, as it used to be a couple of years ago, but a shell script wrapper to `grep -E` instead, the egrep command is to this day still provided by upstream GNU grep and is installed by default if you run `./configure; make; make install` from source. So it is not a backward compatibility hack provided by the distribution.\n
\n
You can check for yourself. Download the source from [ftp.gnu.org/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz), unpack and look for `src/egrep.sh` or line 1756 of `src/Makefile`. Apparently the change from symlink to shell script was done in 2014, and the deprecation warning was added only last year.\n
\n
In any case, my larger point is that the depreciation of `egrep` was a pointless and arbitrary decision that does not benefit users, especially not veterans like myself who have become accustomed to its presence. I don’t mind change, but let’s be honest, most people are not in the habit of checking the minutiae of every little command line utility they use, so a change like this violates the principle of least surprise. It’s one thing if things are changed with a good reason and the users do not only suffer the inconvenience of the change but get to reap the benefits of it as well, but so far I haven’t found any justification for it yet, nor can I think of any.\n
\n
So if there is a portability problem with using `egrep` now, it’s a *self-inflicted* portability problem that they caused by deprecating `egrep` in the first place.\n
\n
> Also, my scripts are not full of bashisms, gnuisms, linuxisms and other -isms, I try to keep them portable unless it is really necessary to use some unportable command or syntax.\n
\n
Good for you. Do you want a cookie or something?
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703616235 {#5545
date: 2023-12-26 19:43:55.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5549 …}
+nested: Doctrine\ORM\PersistentCollection {#5551 …}
+votes: Doctrine\ORM\PersistentCollection {#5553 …}
+reports: Doctrine\ORM\PersistentCollection {#5555 …}
+favourites: Doctrine\ORM\PersistentCollection {#5557 …}
+notifications: Doctrine\ORM\PersistentCollection {#5559 …}
-id: 254374
-bodyTs: "'/configure':105 '/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz),':134 '1756':142 '2014':156 'accustom':197 'ad':162 'ago':74 'also':322 'appar':145 'arbitrari':182 'backward':32,116 'bashism':329 'becom':196 'benefit':187,270 'case':168 'caus':314 'chang':147,205,232,248,264 'check':125,219 'command':86,225,350 'compat':33,117 'cooki':360 'correspond':29 'coupl':71 'day':90 'decis':183 'default':101 'deprec':159,316 'depreci':175 'distribut':16,122 'document':40,49 'done':154 'download':128 'e':82 'egrep':10,59,85,177,302,317 'especi':189 'everi':223 'far':277 'fgrep':11 'first':320 'found':281 'ftp.gnu.org':133 'ftp.gnu.org/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz),':132 'full':327 'get':266 'gnu':1,95 'gnuism':330 'good':251,353 'grep':2,27,81,96 'habit':217 'hack':118 'haven':279 'honest':210 'implement':6 'includ':9 'inconveni':261 'inflict':309 'inform':55 'instal':99,108 'instead':83 'ism':334 'justif':283 'keep':338 'larger':170 'last':164 'learn':36 'least':239 'let':207 'like':192,233 'line':141,226 'linux':331 'littl':224 'longer':62 'look':137 'make':106,107 'mani':20 'mind':204 'minutia':221 'necessari':345 'need':44 'new':54 'offici':39,48 'one':243 'option':30 'peopl':212 'place':321 'point':171 'pointless':180 'portabl':298,310,340 'presenc':200 'principl':237 'problem':299,311 'provid':21,92,119 'read':46 'realli':344 'reap':268 'reason':252 'rgrep':13 'run':26,104 'script':23,78,152,324 'seem':42 'self':308 'self-inflict':307 'shell':22,77,151 'simpli':25 'someth':362 'sourc':110,130 'src/egrep.sh':139 'src/makefile':144 'still':91 'suffer':259 'surpris':240 'symlink':64,149 'syntax':352 'thing':244,246 'think':290 'tri':336 'unless':341 'unpack':135 'unport':349 'upstream':94 'use':67,229,301,347 'user':188,255 'util':227 'veteran':191 'violat':235 'want':358 'warn':160 'well':274 'widespread':5 'wrapper':79 'year':15,73,165 'yet':286"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5578960"
+editedAt: DateTimeImmutable @1708050644 {#5546
date: 2024-02-16 03:30:44.0 +01:00
}
+createdAt: DateTimeImmutable @1703616235 {#5547
date: 2023-12-26 19:43:55.0 +01:00
}
} |
|
Show voter details
|
| 23 |
DENIED
|
edit
|
App\Entity\EntryComment {#5548
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5510
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5425
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4163
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
It is a great book, although a bit outdated. In particular, nowadays `egrep` is not recommended to use. `grep -E` is a more portable synonim.\n
\n
Some notes on you script:\n
\n
1. You don’t need to escape slashes in grep regex. In the sed `s///` command better use another character like `s###` so you also can leave slashes unescaped.\n
2. You usually don’t need to pipe `grep` and `sed`, `sed -n` with regex address and explicit printing command gives the same result as `grep`.\n
3. You could omit leading slash in your `egrep` regex, so you won’t need to remove it later.\n
\n
So I would do the same with\n
\n
```\n
\n
<span style="color:#323232;">tar -tzvf file.tar.gz | sed -En '/.(mp4|mkv)$/{s#^.*/##; s#.[.*##; s#[^a-zA-Z0-9()&-]# #g; s/ +/ /g; p}'\n
</span>\n
```
"""
+lang: "en"
+isAdult: false
+favouriteCount: 14
+score: 0
+lastActive: DateTime @1708114193 {#4164
date: 2024-02-16 21:09:53.0 +01:00
}
+ip: null
+tags: [
"323232"
]
+mentions: [
"@harsh3466@lemmy.world"
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4161 …}
+nested: Doctrine\ORM\PersistentCollection {#4159 …}
+votes: Doctrine\ORM\PersistentCollection {#4157 …}
+reports: Doctrine\ORM\PersistentCollection {#4154 …}
+favourites: Doctrine\ORM\PersistentCollection {#4150 …}
+notifications: Doctrine\ORM\PersistentCollection {#4148 …}
-id: 251438
-bodyTs: "'/g':129 '1':31 '2':60 '3':86 '9':126 'a-za-z0':122 'address':75 'also':55 'although':6 'anoth':49 'better':47 'bit':8 'book':5 'charact':50 'command':46,79 'could':88 'e':20 'egrep':13,94 'en':116 'escap':37 'explicit':77 'file.tar.gz':114 'g':127 'give':80 'great':4 'grep':19,40,68,85 'later':104 'lead':90 'leav':57 'like':51 'mkv':118 'mp4':117 'n':72 'need':35,65,100 'note':27 'nowaday':12 'omit':89 'outdat':9 'p':130 'particular':11 'pipe':67 'portabl':24 'print':78 'recommend':16 'regex':41,74,95 'remov':102 'result':83 'script':30 'sed':44,70,71,115 'slash':38,58,91 'synonim':25 'tar':112 'tzvf':113 'unescap':59 'use':18,48 'usual':62 'won':98 'would':107 'z0':125 'za':124"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6875297"
+editedAt: DateTimeImmutable @1707737027 {#4169
date: 2024-02-12 12:23:47.0 +01:00
}
+createdAt: DateTimeImmutable @1703524389 {#4167
date: 2023-12-25 18:13:09.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> nowadays egrep is not recommended to use. grep -E is a more portable synonim\n
\n
Not directed at you personally, but this is the kind of pointless pedantry from upstream developers that grinds my gears.\n
\n
Like, I’ve used `egrep` for 25 years. I don’t know of a still relevant Unix variant in existence that doesn’t have the `egrep` command. But suddenly now, when any other Unix variant but Linux is all but extinct, and all your shell scripts are probably full of bashisms and Linuxisms anyway, *now* there is somehow a portability problem, and they deem it necessary to print out a warning whenever I dare to run `egrep` instead of `grep -E`? C’mon now … If anything, they have just made it *less* portable by spitting out spurious warnings where there weren’t any before.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 8
+score: 0
+lastActive: DateTime @1703590646 {#5423
date: 2023-12-26 12:37:26.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
]
+children: Doctrine\ORM\PersistentCollection {#5427 …}
+nested: Doctrine\ORM\PersistentCollection {#5429 …}
+votes: Doctrine\ORM\PersistentCollection {#5431 …}
+reports: Doctrine\ORM\PersistentCollection {#5433 …}
+favourites: Doctrine\ORM\PersistentCollection {#5435 …}
+notifications: Doctrine\ORM\PersistentCollection {#5437 …}
-id: 253349
-bodyTs: "'25':41 'anyth':120 'anyway':88 'bashism':85 'c':116 'command':61 'dare':108 'deem':98 'develop':30 'direct':16 'doesn':56 'e':9,115 'egrep':2,39,60,111 'exist':54 'extinct':75 'full':83 'gear':34 'grep':8,114 'grind':32 'instead':112 'kind':24 'know':46 'less':126 'like':35 'linux':71,87 'made':124 'mon':117 'necessari':100 'nowaday':1 'pedantri':27 'person':19 'pointless':26 'portabl':13,94,127 'print':102 'probabl':82 'problem':95 'recommend':5 'relev':50 'run':110 'script':80 'shell':79 'somehow':92 'spit':129 'spurious':131 'still':49 'sudden':63 'synonim':14 'unix':51,68 'upstream':29 'use':7,38 'variant':52,69 've':37 'warn':105,132 'weren':135 'whenev':106 'year':42"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5573914"
+editedAt: null
+createdAt: DateTimeImmutable @1703590646 {#5424
date: 2023-12-26 12:37:26.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
GNU grep, the most widespread implementation, does not include `egrep`, `fgrep` and `rgrep` for years. Distributions (not all, but many) provide shell scripts that simply run `grep` with corresponding option for backward compatibility. You can learn this from official documentation.\n
\n
Also, *my* scripts are not full of bashisms, gnuisms, linuxisms and other -isms, I try to keep them portable unless it is really necessary to use some unportable command or syntax.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703613068 {#5508
date: 2023-12-26 18:51:08.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5511 …}
+nested: Doctrine\ORM\PersistentCollection {#5513 …}
+votes: Doctrine\ORM\PersistentCollection {#5515 …}
+reports: Doctrine\ORM\PersistentCollection {#5517 …}
+favourites: Doctrine\ORM\PersistentCollection {#5519 …}
+notifications: Doctrine\ORM\PersistentCollection {#5521 …}
-id: 254226
-bodyTs: "'also':41 'backward':32 'bashism':48 'command':69 'compat':33 'correspond':29 'distribut':16 'document':40 'egrep':10 'fgrep':11 'full':46 'gnu':1 'gnuism':49 'grep':2,27 'implement':6 'includ':9 'ism':53 'keep':57 'learn':36 'linux':50 'mani':20 'necessari':64 'offici':39 'option':30 'portabl':59 'provid':21 'realli':63 'rgrep':13 'run':26 'script':23,43 'shell':22 'simpli':25 'syntax':71 'tri':55 'unless':60 'unport':68 'use':66 'widespread':5 'year':15"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6891772"
+editedAt: null
+createdAt: DateTimeImmutable @1703613068 {#5509
date: 2023-12-26 18:51:08.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> GNU grep, the most widespread implementation, does not include egrep, fgrep and rgrep for years. Distributions (not all, but many) provide shell scripts that simply run grep with corresponding option for backward compatibility. You can learn this from official documentation.\n
\n
It seems you need to read the official documentation yourself. While it’s new information to me that `egrep` is no longer a symlink, as it used to be a couple of years ago, but a shell script wrapper to `grep -E` instead, the egrep command is to this day still provided by upstream GNU grep and is installed by default if you run `./configure; make; make install` from source. So it is not a backward compatibility hack provided by the distribution.\n
\n
You can check for yourself. Download the source from [ftp.gnu.org/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz), unpack and look for `src/egrep.sh` or line 1756 of `src/Makefile`. Apparently the change from symlink to shell script was done in 2014, and the deprecation warning was added only last year.\n
\n
In any case, my larger point is that the depreciation of `egrep` was a pointless and arbitrary decision that does not benefit users, especially not veterans like myself who have become accustomed to its presence. I don’t mind change, but let’s be honest, most people are not in the habit of checking the minutiae of every little command line utility they use, so a change like this violates the principle of least surprise. It’s one thing if things are changed with a good reason and the users do not only suffer the inconvenience of the change but get to reap the benefits of it as well, but so far I haven’t found any justification for it yet, nor can I think of any.\n
\n
So if there is a portability problem with using `egrep` now, it’s a *self-inflicted* portability problem that they caused by deprecating `egrep` in the first place.\n
\n
> Also, my scripts are not full of bashisms, gnuisms, linuxisms and other -isms, I try to keep them portable unless it is really necessary to use some unportable command or syntax.\n
\n
Good for you. Do you want a cookie or something?
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703616235 {#5545
date: 2023-12-26 19:43:55.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5549 …}
+nested: Doctrine\ORM\PersistentCollection {#5551 …}
+votes: Doctrine\ORM\PersistentCollection {#5553 …}
+reports: Doctrine\ORM\PersistentCollection {#5555 …}
+favourites: Doctrine\ORM\PersistentCollection {#5557 …}
+notifications: Doctrine\ORM\PersistentCollection {#5559 …}
-id: 254374
-bodyTs: "'/configure':105 '/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz),':134 '1756':142 '2014':156 'accustom':197 'ad':162 'ago':74 'also':322 'appar':145 'arbitrari':182 'backward':32,116 'bashism':329 'becom':196 'benefit':187,270 'case':168 'caus':314 'chang':147,205,232,248,264 'check':125,219 'command':86,225,350 'compat':33,117 'cooki':360 'correspond':29 'coupl':71 'day':90 'decis':183 'default':101 'deprec':159,316 'depreci':175 'distribut':16,122 'document':40,49 'done':154 'download':128 'e':82 'egrep':10,59,85,177,302,317 'especi':189 'everi':223 'far':277 'fgrep':11 'first':320 'found':281 'ftp.gnu.org':133 'ftp.gnu.org/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz),':132 'full':327 'get':266 'gnu':1,95 'gnuism':330 'good':251,353 'grep':2,27,81,96 'habit':217 'hack':118 'haven':279 'honest':210 'implement':6 'includ':9 'inconveni':261 'inflict':309 'inform':55 'instal':99,108 'instead':83 'ism':334 'justif':283 'keep':338 'larger':170 'last':164 'learn':36 'least':239 'let':207 'like':192,233 'line':141,226 'linux':331 'littl':224 'longer':62 'look':137 'make':106,107 'mani':20 'mind':204 'minutia':221 'necessari':345 'need':44 'new':54 'offici':39,48 'one':243 'option':30 'peopl':212 'place':321 'point':171 'pointless':180 'portabl':298,310,340 'presenc':200 'principl':237 'problem':299,311 'provid':21,92,119 'read':46 'realli':344 'reap':268 'reason':252 'rgrep':13 'run':26,104 'script':23,78,152,324 'seem':42 'self':308 'self-inflict':307 'shell':22,77,151 'simpli':25 'someth':362 'sourc':110,130 'src/egrep.sh':139 'src/makefile':144 'still':91 'suffer':259 'surpris':240 'symlink':64,149 'syntax':352 'thing':244,246 'think':290 'tri':336 'unless':341 'unpack':135 'unport':349 'upstream':94 'use':67,229,301,347 'user':188,255 'util':227 'veteran':191 'violat':235 'want':358 'warn':160 'well':274 'widespread':5 'wrapper':79 'year':15,73,165 'yet':286"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5578960"
+editedAt: DateTimeImmutable @1708050644 {#5546
date: 2024-02-16 03:30:44.0 +01:00
}
+createdAt: DateTimeImmutable @1703616235 {#5547
date: 2023-12-26 19:43:55.0 +01:00
}
} |
|
Show voter details
|
| 24 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5548
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5510
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5425
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4163
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
It is a great book, although a bit outdated. In particular, nowadays `egrep` is not recommended to use. `grep -E` is a more portable synonim.\n
\n
Some notes on you script:\n
\n
1. You don’t need to escape slashes in grep regex. In the sed `s///` command better use another character like `s###` so you also can leave slashes unescaped.\n
2. You usually don’t need to pipe `grep` and `sed`, `sed -n` with regex address and explicit printing command gives the same result as `grep`.\n
3. You could omit leading slash in your `egrep` regex, so you won’t need to remove it later.\n
\n
So I would do the same with\n
\n
```\n
\n
<span style="color:#323232;">tar -tzvf file.tar.gz | sed -En '/.(mp4|mkv)$/{s#^.*/##; s#.[.*##; s#[^a-zA-Z0-9()&-]# #g; s/ +/ /g; p}'\n
</span>\n
```
"""
+lang: "en"
+isAdult: false
+favouriteCount: 14
+score: 0
+lastActive: DateTime @1708114193 {#4164
date: 2024-02-16 21:09:53.0 +01:00
}
+ip: null
+tags: [
"323232"
]
+mentions: [
"@harsh3466@lemmy.world"
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4161 …}
+nested: Doctrine\ORM\PersistentCollection {#4159 …}
+votes: Doctrine\ORM\PersistentCollection {#4157 …}
+reports: Doctrine\ORM\PersistentCollection {#4154 …}
+favourites: Doctrine\ORM\PersistentCollection {#4150 …}
+notifications: Doctrine\ORM\PersistentCollection {#4148 …}
-id: 251438
-bodyTs: "'/g':129 '1':31 '2':60 '3':86 '9':126 'a-za-z0':122 'address':75 'also':55 'although':6 'anoth':49 'better':47 'bit':8 'book':5 'charact':50 'command':46,79 'could':88 'e':20 'egrep':13,94 'en':116 'escap':37 'explicit':77 'file.tar.gz':114 'g':127 'give':80 'great':4 'grep':19,40,68,85 'later':104 'lead':90 'leav':57 'like':51 'mkv':118 'mp4':117 'n':72 'need':35,65,100 'note':27 'nowaday':12 'omit':89 'outdat':9 'p':130 'particular':11 'pipe':67 'portabl':24 'print':78 'recommend':16 'regex':41,74,95 'remov':102 'result':83 'script':30 'sed':44,70,71,115 'slash':38,58,91 'synonim':25 'tar':112 'tzvf':113 'unescap':59 'use':18,48 'usual':62 'won':98 'would':107 'z0':125 'za':124"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6875297"
+editedAt: DateTimeImmutable @1707737027 {#4169
date: 2024-02-12 12:23:47.0 +01:00
}
+createdAt: DateTimeImmutable @1703524389 {#4167
date: 2023-12-25 18:13:09.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> nowadays egrep is not recommended to use. grep -E is a more portable synonim\n
\n
Not directed at you personally, but this is the kind of pointless pedantry from upstream developers that grinds my gears.\n
\n
Like, I’ve used `egrep` for 25 years. I don’t know of a still relevant Unix variant in existence that doesn’t have the `egrep` command. But suddenly now, when any other Unix variant but Linux is all but extinct, and all your shell scripts are probably full of bashisms and Linuxisms anyway, *now* there is somehow a portability problem, and they deem it necessary to print out a warning whenever I dare to run `egrep` instead of `grep -E`? C’mon now … If anything, they have just made it *less* portable by spitting out spurious warnings where there weren’t any before.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 8
+score: 0
+lastActive: DateTime @1703590646 {#5423
date: 2023-12-26 12:37:26.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
]
+children: Doctrine\ORM\PersistentCollection {#5427 …}
+nested: Doctrine\ORM\PersistentCollection {#5429 …}
+votes: Doctrine\ORM\PersistentCollection {#5431 …}
+reports: Doctrine\ORM\PersistentCollection {#5433 …}
+favourites: Doctrine\ORM\PersistentCollection {#5435 …}
+notifications: Doctrine\ORM\PersistentCollection {#5437 …}
-id: 253349
-bodyTs: "'25':41 'anyth':120 'anyway':88 'bashism':85 'c':116 'command':61 'dare':108 'deem':98 'develop':30 'direct':16 'doesn':56 'e':9,115 'egrep':2,39,60,111 'exist':54 'extinct':75 'full':83 'gear':34 'grep':8,114 'grind':32 'instead':112 'kind':24 'know':46 'less':126 'like':35 'linux':71,87 'made':124 'mon':117 'necessari':100 'nowaday':1 'pedantri':27 'person':19 'pointless':26 'portabl':13,94,127 'print':102 'probabl':82 'problem':95 'recommend':5 'relev':50 'run':110 'script':80 'shell':79 'somehow':92 'spit':129 'spurious':131 'still':49 'sudden':63 'synonim':14 'unix':51,68 'upstream':29 'use':7,38 'variant':52,69 've':37 'warn':105,132 'weren':135 'whenev':106 'year':42"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5573914"
+editedAt: null
+createdAt: DateTimeImmutable @1703590646 {#5424
date: 2023-12-26 12:37:26.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
GNU grep, the most widespread implementation, does not include `egrep`, `fgrep` and `rgrep` for years. Distributions (not all, but many) provide shell scripts that simply run `grep` with corresponding option for backward compatibility. You can learn this from official documentation.\n
\n
Also, *my* scripts are not full of bashisms, gnuisms, linuxisms and other -isms, I try to keep them portable unless it is really necessary to use some unportable command or syntax.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703613068 {#5508
date: 2023-12-26 18:51:08.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5511 …}
+nested: Doctrine\ORM\PersistentCollection {#5513 …}
+votes: Doctrine\ORM\PersistentCollection {#5515 …}
+reports: Doctrine\ORM\PersistentCollection {#5517 …}
+favourites: Doctrine\ORM\PersistentCollection {#5519 …}
+notifications: Doctrine\ORM\PersistentCollection {#5521 …}
-id: 254226
-bodyTs: "'also':41 'backward':32 'bashism':48 'command':69 'compat':33 'correspond':29 'distribut':16 'document':40 'egrep':10 'fgrep':11 'full':46 'gnu':1 'gnuism':49 'grep':2,27 'implement':6 'includ':9 'ism':53 'keep':57 'learn':36 'linux':50 'mani':20 'necessari':64 'offici':39 'option':30 'portabl':59 'provid':21 'realli':63 'rgrep':13 'run':26 'script':23,43 'shell':22 'simpli':25 'syntax':71 'tri':55 'unless':60 'unport':68 'use':66 'widespread':5 'year':15"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6891772"
+editedAt: null
+createdAt: DateTimeImmutable @1703613068 {#5509
date: 2023-12-26 18:51:08.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> GNU grep, the most widespread implementation, does not include egrep, fgrep and rgrep for years. Distributions (not all, but many) provide shell scripts that simply run grep with corresponding option for backward compatibility. You can learn this from official documentation.\n
\n
It seems you need to read the official documentation yourself. While it’s new information to me that `egrep` is no longer a symlink, as it used to be a couple of years ago, but a shell script wrapper to `grep -E` instead, the egrep command is to this day still provided by upstream GNU grep and is installed by default if you run `./configure; make; make install` from source. So it is not a backward compatibility hack provided by the distribution.\n
\n
You can check for yourself. Download the source from [ftp.gnu.org/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz), unpack and look for `src/egrep.sh` or line 1756 of `src/Makefile`. Apparently the change from symlink to shell script was done in 2014, and the deprecation warning was added only last year.\n
\n
In any case, my larger point is that the depreciation of `egrep` was a pointless and arbitrary decision that does not benefit users, especially not veterans like myself who have become accustomed to its presence. I don’t mind change, but let’s be honest, most people are not in the habit of checking the minutiae of every little command line utility they use, so a change like this violates the principle of least surprise. It’s one thing if things are changed with a good reason and the users do not only suffer the inconvenience of the change but get to reap the benefits of it as well, but so far I haven’t found any justification for it yet, nor can I think of any.\n
\n
So if there is a portability problem with using `egrep` now, it’s a *self-inflicted* portability problem that they caused by deprecating `egrep` in the first place.\n
\n
> Also, my scripts are not full of bashisms, gnuisms, linuxisms and other -isms, I try to keep them portable unless it is really necessary to use some unportable command or syntax.\n
\n
Good for you. Do you want a cookie or something?
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703616235 {#5545
date: 2023-12-26 19:43:55.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5549 …}
+nested: Doctrine\ORM\PersistentCollection {#5551 …}
+votes: Doctrine\ORM\PersistentCollection {#5553 …}
+reports: Doctrine\ORM\PersistentCollection {#5555 …}
+favourites: Doctrine\ORM\PersistentCollection {#5557 …}
+notifications: Doctrine\ORM\PersistentCollection {#5559 …}
-id: 254374
-bodyTs: "'/configure':105 '/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz),':134 '1756':142 '2014':156 'accustom':197 'ad':162 'ago':74 'also':322 'appar':145 'arbitrari':182 'backward':32,116 'bashism':329 'becom':196 'benefit':187,270 'case':168 'caus':314 'chang':147,205,232,248,264 'check':125,219 'command':86,225,350 'compat':33,117 'cooki':360 'correspond':29 'coupl':71 'day':90 'decis':183 'default':101 'deprec':159,316 'depreci':175 'distribut':16,122 'document':40,49 'done':154 'download':128 'e':82 'egrep':10,59,85,177,302,317 'especi':189 'everi':223 'far':277 'fgrep':11 'first':320 'found':281 'ftp.gnu.org':133 'ftp.gnu.org/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz),':132 'full':327 'get':266 'gnu':1,95 'gnuism':330 'good':251,353 'grep':2,27,81,96 'habit':217 'hack':118 'haven':279 'honest':210 'implement':6 'includ':9 'inconveni':261 'inflict':309 'inform':55 'instal':99,108 'instead':83 'ism':334 'justif':283 'keep':338 'larger':170 'last':164 'learn':36 'least':239 'let':207 'like':192,233 'line':141,226 'linux':331 'littl':224 'longer':62 'look':137 'make':106,107 'mani':20 'mind':204 'minutia':221 'necessari':345 'need':44 'new':54 'offici':39,48 'one':243 'option':30 'peopl':212 'place':321 'point':171 'pointless':180 'portabl':298,310,340 'presenc':200 'principl':237 'problem':299,311 'provid':21,92,119 'read':46 'realli':344 'reap':268 'reason':252 'rgrep':13 'run':26,104 'script':23,78,152,324 'seem':42 'self':308 'self-inflict':307 'shell':22,77,151 'simpli':25 'someth':362 'sourc':110,130 'src/egrep.sh':139 'src/makefile':144 'still':91 'suffer':259 'surpris':240 'symlink':64,149 'syntax':352 'thing':244,246 'think':290 'tri':336 'unless':341 'unpack':135 'unport':349 'upstream':94 'use':67,229,301,347 'user':188,255 'util':227 'veteran':191 'violat':235 'want':358 'warn':160 'well':274 'widespread':5 'wrapper':79 'year':15,73,165 'yet':286"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5578960"
+editedAt: DateTimeImmutable @1708050644 {#5546
date: 2024-02-16 03:30:44.0 +01:00
}
+createdAt: DateTimeImmutable @1703616235 {#5547
date: 2023-12-26 19:43:55.0 +01:00
}
} |
|
Show voter details
|
| 25 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 26 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5585
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5548
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5510
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5425
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4163
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
It is a great book, although a bit outdated. In particular, nowadays `egrep` is not recommended to use. `grep -E` is a more portable synonim.\n
\n
Some notes on you script:\n
\n
1. You don’t need to escape slashes in grep regex. In the sed `s///` command better use another character like `s###` so you also can leave slashes unescaped.\n
2. You usually don’t need to pipe `grep` and `sed`, `sed -n` with regex address and explicit printing command gives the same result as `grep`.\n
3. You could omit leading slash in your `egrep` regex, so you won’t need to remove it later.\n
\n
So I would do the same with\n
\n
```\n
\n
<span style="color:#323232;">tar -tzvf file.tar.gz | sed -En '/.(mp4|mkv)$/{s#^.*/##; s#.[.*##; s#[^a-zA-Z0-9()&-]# #g; s/ +/ /g; p}'\n
</span>\n
```
"""
+lang: "en"
+isAdult: false
+favouriteCount: 14
+score: 0
+lastActive: DateTime @1708114193 {#4164
date: 2024-02-16 21:09:53.0 +01:00
}
+ip: null
+tags: [
"323232"
]
+mentions: [
"@harsh3466@lemmy.world"
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4161 …}
+nested: Doctrine\ORM\PersistentCollection {#4159 …}
+votes: Doctrine\ORM\PersistentCollection {#4157 …}
+reports: Doctrine\ORM\PersistentCollection {#4154 …}
+favourites: Doctrine\ORM\PersistentCollection {#4150 …}
+notifications: Doctrine\ORM\PersistentCollection {#4148 …}
-id: 251438
-bodyTs: "'/g':129 '1':31 '2':60 '3':86 '9':126 'a-za-z0':122 'address':75 'also':55 'although':6 'anoth':49 'better':47 'bit':8 'book':5 'charact':50 'command':46,79 'could':88 'e':20 'egrep':13,94 'en':116 'escap':37 'explicit':77 'file.tar.gz':114 'g':127 'give':80 'great':4 'grep':19,40,68,85 'later':104 'lead':90 'leav':57 'like':51 'mkv':118 'mp4':117 'n':72 'need':35,65,100 'note':27 'nowaday':12 'omit':89 'outdat':9 'p':130 'particular':11 'pipe':67 'portabl':24 'print':78 'recommend':16 'regex':41,74,95 'remov':102 'result':83 'script':30 'sed':44,70,71,115 'slash':38,58,91 'synonim':25 'tar':112 'tzvf':113 'unescap':59 'use':18,48 'usual':62 'won':98 'would':107 'z0':125 'za':124"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6875297"
+editedAt: DateTimeImmutable @1707737027 {#4169
date: 2024-02-12 12:23:47.0 +01:00
}
+createdAt: DateTimeImmutable @1703524389 {#4167
date: 2023-12-25 18:13:09.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> nowadays egrep is not recommended to use. grep -E is a more portable synonim\n
\n
Not directed at you personally, but this is the kind of pointless pedantry from upstream developers that grinds my gears.\n
\n
Like, I’ve used `egrep` for 25 years. I don’t know of a still relevant Unix variant in existence that doesn’t have the `egrep` command. But suddenly now, when any other Unix variant but Linux is all but extinct, and all your shell scripts are probably full of bashisms and Linuxisms anyway, *now* there is somehow a portability problem, and they deem it necessary to print out a warning whenever I dare to run `egrep` instead of `grep -E`? C’mon now … If anything, they have just made it *less* portable by spitting out spurious warnings where there weren’t any before.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 8
+score: 0
+lastActive: DateTime @1703590646 {#5423
date: 2023-12-26 12:37:26.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
]
+children: Doctrine\ORM\PersistentCollection {#5427 …}
+nested: Doctrine\ORM\PersistentCollection {#5429 …}
+votes: Doctrine\ORM\PersistentCollection {#5431 …}
+reports: Doctrine\ORM\PersistentCollection {#5433 …}
+favourites: Doctrine\ORM\PersistentCollection {#5435 …}
+notifications: Doctrine\ORM\PersistentCollection {#5437 …}
-id: 253349
-bodyTs: "'25':41 'anyth':120 'anyway':88 'bashism':85 'c':116 'command':61 'dare':108 'deem':98 'develop':30 'direct':16 'doesn':56 'e':9,115 'egrep':2,39,60,111 'exist':54 'extinct':75 'full':83 'gear':34 'grep':8,114 'grind':32 'instead':112 'kind':24 'know':46 'less':126 'like':35 'linux':71,87 'made':124 'mon':117 'necessari':100 'nowaday':1 'pedantri':27 'person':19 'pointless':26 'portabl':13,94,127 'print':102 'probabl':82 'problem':95 'recommend':5 'relev':50 'run':110 'script':80 'shell':79 'somehow':92 'spit':129 'spurious':131 'still':49 'sudden':63 'synonim':14 'unix':51,68 'upstream':29 'use':7,38 'variant':52,69 've':37 'warn':105,132 'weren':135 'whenev':106 'year':42"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5573914"
+editedAt: null
+createdAt: DateTimeImmutable @1703590646 {#5424
date: 2023-12-26 12:37:26.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
GNU grep, the most widespread implementation, does not include `egrep`, `fgrep` and `rgrep` for years. Distributions (not all, but many) provide shell scripts that simply run `grep` with corresponding option for backward compatibility. You can learn this from official documentation.\n
\n
Also, *my* scripts are not full of bashisms, gnuisms, linuxisms and other -isms, I try to keep them portable unless it is really necessary to use some unportable command or syntax.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703613068 {#5508
date: 2023-12-26 18:51:08.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5511 …}
+nested: Doctrine\ORM\PersistentCollection {#5513 …}
+votes: Doctrine\ORM\PersistentCollection {#5515 …}
+reports: Doctrine\ORM\PersistentCollection {#5517 …}
+favourites: Doctrine\ORM\PersistentCollection {#5519 …}
+notifications: Doctrine\ORM\PersistentCollection {#5521 …}
-id: 254226
-bodyTs: "'also':41 'backward':32 'bashism':48 'command':69 'compat':33 'correspond':29 'distribut':16 'document':40 'egrep':10 'fgrep':11 'full':46 'gnu':1 'gnuism':49 'grep':2,27 'implement':6 'includ':9 'ism':53 'keep':57 'learn':36 'linux':50 'mani':20 'necessari':64 'offici':39 'option':30 'portabl':59 'provid':21 'realli':63 'rgrep':13 'run':26 'script':23,43 'shell':22 'simpli':25 'syntax':71 'tri':55 'unless':60 'unport':68 'use':66 'widespread':5 'year':15"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6891772"
+editedAt: null
+createdAt: DateTimeImmutable @1703613068 {#5509
date: 2023-12-26 18:51:08.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> GNU grep, the most widespread implementation, does not include egrep, fgrep and rgrep for years. Distributions (not all, but many) provide shell scripts that simply run grep with corresponding option for backward compatibility. You can learn this from official documentation.\n
\n
It seems you need to read the official documentation yourself. While it’s new information to me that `egrep` is no longer a symlink, as it used to be a couple of years ago, but a shell script wrapper to `grep -E` instead, the egrep command is to this day still provided by upstream GNU grep and is installed by default if you run `./configure; make; make install` from source. So it is not a backward compatibility hack provided by the distribution.\n
\n
You can check for yourself. Download the source from [ftp.gnu.org/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz), unpack and look for `src/egrep.sh` or line 1756 of `src/Makefile`. Apparently the change from symlink to shell script was done in 2014, and the deprecation warning was added only last year.\n
\n
In any case, my larger point is that the depreciation of `egrep` was a pointless and arbitrary decision that does not benefit users, especially not veterans like myself who have become accustomed to its presence. I don’t mind change, but let’s be honest, most people are not in the habit of checking the minutiae of every little command line utility they use, so a change like this violates the principle of least surprise. It’s one thing if things are changed with a good reason and the users do not only suffer the inconvenience of the change but get to reap the benefits of it as well, but so far I haven’t found any justification for it yet, nor can I think of any.\n
\n
So if there is a portability problem with using `egrep` now, it’s a *self-inflicted* portability problem that they caused by deprecating `egrep` in the first place.\n
\n
> Also, my scripts are not full of bashisms, gnuisms, linuxisms and other -isms, I try to keep them portable unless it is really necessary to use some unportable command or syntax.\n
\n
Good for you. Do you want a cookie or something?
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703616235 {#5545
date: 2023-12-26 19:43:55.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5549 …}
+nested: Doctrine\ORM\PersistentCollection {#5551 …}
+votes: Doctrine\ORM\PersistentCollection {#5553 …}
+reports: Doctrine\ORM\PersistentCollection {#5555 …}
+favourites: Doctrine\ORM\PersistentCollection {#5557 …}
+notifications: Doctrine\ORM\PersistentCollection {#5559 …}
-id: 254374
-bodyTs: "'/configure':105 '/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz),':134 '1756':142 '2014':156 'accustom':197 'ad':162 'ago':74 'also':322 'appar':145 'arbitrari':182 'backward':32,116 'bashism':329 'becom':196 'benefit':187,270 'case':168 'caus':314 'chang':147,205,232,248,264 'check':125,219 'command':86,225,350 'compat':33,117 'cooki':360 'correspond':29 'coupl':71 'day':90 'decis':183 'default':101 'deprec':159,316 'depreci':175 'distribut':16,122 'document':40,49 'done':154 'download':128 'e':82 'egrep':10,59,85,177,302,317 'especi':189 'everi':223 'far':277 'fgrep':11 'first':320 'found':281 'ftp.gnu.org':133 'ftp.gnu.org/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz),':132 'full':327 'get':266 'gnu':1,95 'gnuism':330 'good':251,353 'grep':2,27,81,96 'habit':217 'hack':118 'haven':279 'honest':210 'implement':6 'includ':9 'inconveni':261 'inflict':309 'inform':55 'instal':99,108 'instead':83 'ism':334 'justif':283 'keep':338 'larger':170 'last':164 'learn':36 'least':239 'let':207 'like':192,233 'line':141,226 'linux':331 'littl':224 'longer':62 'look':137 'make':106,107 'mani':20 'mind':204 'minutia':221 'necessari':345 'need':44 'new':54 'offici':39,48 'one':243 'option':30 'peopl':212 'place':321 'point':171 'pointless':180 'portabl':298,310,340 'presenc':200 'principl':237 'problem':299,311 'provid':21,92,119 'read':46 'realli':344 'reap':268 'reason':252 'rgrep':13 'run':26,104 'script':23,78,152,324 'seem':42 'self':308 'self-inflict':307 'shell':22,77,151 'simpli':25 'someth':362 'sourc':110,130 'src/egrep.sh':139 'src/makefile':144 'still':91 'suffer':259 'surpris':240 'symlink':64,149 'syntax':352 'thing':244,246 'think':290 'tri':336 'unless':341 'unpack':135 'unport':349 'upstream':94 'use':67,229,301,347 'user':188,255 'util':227 'veteran':191 'violat':235 'want':358 'warn':160 'well':274 'widespread':5 'wrapper':79 'year':15,73,165 'yet':286"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5578960"
+editedAt: DateTimeImmutable @1708050644 {#5546
date: 2024-02-16 03:30:44.0 +01:00
}
+createdAt: DateTimeImmutable @1703616235 {#5547
date: 2023-12-26 19:43:55.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> It seems you need to read the official documentation yourself.\n
\n
I did. [Debian man page](https://manpages.debian.org/bookworm/grep/grep.1.en.html), [GNU grep manual](https://www.gnu.org/software/grep/manual/html_node/Usage.html).\n
\n
I’m sorry for your loss, however the egrep deprecation is a fact. Of course you can continue using it as a veteran, but it is not correct to recommend this to beginners.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703620836 {#5583
date: 2023-12-26 21:00:36.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5586 …}
+nested: Doctrine\ORM\PersistentCollection {#5588 …}
+votes: Doctrine\ORM\PersistentCollection {#5590 …}
+reports: Doctrine\ORM\PersistentCollection {#5592 …}
+favourites: Doctrine\ORM\PersistentCollection {#5594 …}
+notifications: Doctrine\ORM\PersistentCollection {#5596 …}
-id: 254537
-bodyTs: "'/bookworm/grep/grep.1.en.html),':18 '/software/grep/manual/html_node/usage.html).':24 'beginn':57 'continu':42 'correct':52 'cours':39 'debian':13 'deprec':34 'document':9 'egrep':33 'fact':37 'gnu':19 'grep':20 'howev':31 'loss':30 'm':26 'man':14 'manpages.debian.org':17 'manpages.debian.org/bookworm/grep/grep.1.en.html),':16 'manual':21 'need':4 'offici':8 'page':15 'read':6 'recommend':54 'seem':2 'sorri':27 'use':43 'veteran':47 'www.gnu.org':23 'www.gnu.org/software/grep/manual/html_node/usage.html).':22"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6893637"
+editedAt: null
+createdAt: DateTimeImmutable @1703620836 {#5584
date: 2023-12-26 21:00:36.0 +01:00
}
} |
|
Show voter details
|
| 27 |
DENIED
|
edit
|
App\Entity\EntryComment {#5585
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5548
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5510
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5425
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4163
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
It is a great book, although a bit outdated. In particular, nowadays `egrep` is not recommended to use. `grep -E` is a more portable synonim.\n
\n
Some notes on you script:\n
\n
1. You don’t need to escape slashes in grep regex. In the sed `s///` command better use another character like `s###` so you also can leave slashes unescaped.\n
2. You usually don’t need to pipe `grep` and `sed`, `sed -n` with regex address and explicit printing command gives the same result as `grep`.\n
3. You could omit leading slash in your `egrep` regex, so you won’t need to remove it later.\n
\n
So I would do the same with\n
\n
```\n
\n
<span style="color:#323232;">tar -tzvf file.tar.gz | sed -En '/.(mp4|mkv)$/{s#^.*/##; s#.[.*##; s#[^a-zA-Z0-9()&-]# #g; s/ +/ /g; p}'\n
</span>\n
```
"""
+lang: "en"
+isAdult: false
+favouriteCount: 14
+score: 0
+lastActive: DateTime @1708114193 {#4164
date: 2024-02-16 21:09:53.0 +01:00
}
+ip: null
+tags: [
"323232"
]
+mentions: [
"@harsh3466@lemmy.world"
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4161 …}
+nested: Doctrine\ORM\PersistentCollection {#4159 …}
+votes: Doctrine\ORM\PersistentCollection {#4157 …}
+reports: Doctrine\ORM\PersistentCollection {#4154 …}
+favourites: Doctrine\ORM\PersistentCollection {#4150 …}
+notifications: Doctrine\ORM\PersistentCollection {#4148 …}
-id: 251438
-bodyTs: "'/g':129 '1':31 '2':60 '3':86 '9':126 'a-za-z0':122 'address':75 'also':55 'although':6 'anoth':49 'better':47 'bit':8 'book':5 'charact':50 'command':46,79 'could':88 'e':20 'egrep':13,94 'en':116 'escap':37 'explicit':77 'file.tar.gz':114 'g':127 'give':80 'great':4 'grep':19,40,68,85 'later':104 'lead':90 'leav':57 'like':51 'mkv':118 'mp4':117 'n':72 'need':35,65,100 'note':27 'nowaday':12 'omit':89 'outdat':9 'p':130 'particular':11 'pipe':67 'portabl':24 'print':78 'recommend':16 'regex':41,74,95 'remov':102 'result':83 'script':30 'sed':44,70,71,115 'slash':38,58,91 'synonim':25 'tar':112 'tzvf':113 'unescap':59 'use':18,48 'usual':62 'won':98 'would':107 'z0':125 'za':124"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6875297"
+editedAt: DateTimeImmutable @1707737027 {#4169
date: 2024-02-12 12:23:47.0 +01:00
}
+createdAt: DateTimeImmutable @1703524389 {#4167
date: 2023-12-25 18:13:09.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> nowadays egrep is not recommended to use. grep -E is a more portable synonim\n
\n
Not directed at you personally, but this is the kind of pointless pedantry from upstream developers that grinds my gears.\n
\n
Like, I’ve used `egrep` for 25 years. I don’t know of a still relevant Unix variant in existence that doesn’t have the `egrep` command. But suddenly now, when any other Unix variant but Linux is all but extinct, and all your shell scripts are probably full of bashisms and Linuxisms anyway, *now* there is somehow a portability problem, and they deem it necessary to print out a warning whenever I dare to run `egrep` instead of `grep -E`? C’mon now … If anything, they have just made it *less* portable by spitting out spurious warnings where there weren’t any before.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 8
+score: 0
+lastActive: DateTime @1703590646 {#5423
date: 2023-12-26 12:37:26.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
]
+children: Doctrine\ORM\PersistentCollection {#5427 …}
+nested: Doctrine\ORM\PersistentCollection {#5429 …}
+votes: Doctrine\ORM\PersistentCollection {#5431 …}
+reports: Doctrine\ORM\PersistentCollection {#5433 …}
+favourites: Doctrine\ORM\PersistentCollection {#5435 …}
+notifications: Doctrine\ORM\PersistentCollection {#5437 …}
-id: 253349
-bodyTs: "'25':41 'anyth':120 'anyway':88 'bashism':85 'c':116 'command':61 'dare':108 'deem':98 'develop':30 'direct':16 'doesn':56 'e':9,115 'egrep':2,39,60,111 'exist':54 'extinct':75 'full':83 'gear':34 'grep':8,114 'grind':32 'instead':112 'kind':24 'know':46 'less':126 'like':35 'linux':71,87 'made':124 'mon':117 'necessari':100 'nowaday':1 'pedantri':27 'person':19 'pointless':26 'portabl':13,94,127 'print':102 'probabl':82 'problem':95 'recommend':5 'relev':50 'run':110 'script':80 'shell':79 'somehow':92 'spit':129 'spurious':131 'still':49 'sudden':63 'synonim':14 'unix':51,68 'upstream':29 'use':7,38 'variant':52,69 've':37 'warn':105,132 'weren':135 'whenev':106 'year':42"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5573914"
+editedAt: null
+createdAt: DateTimeImmutable @1703590646 {#5424
date: 2023-12-26 12:37:26.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
GNU grep, the most widespread implementation, does not include `egrep`, `fgrep` and `rgrep` for years. Distributions (not all, but many) provide shell scripts that simply run `grep` with corresponding option for backward compatibility. You can learn this from official documentation.\n
\n
Also, *my* scripts are not full of bashisms, gnuisms, linuxisms and other -isms, I try to keep them portable unless it is really necessary to use some unportable command or syntax.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703613068 {#5508
date: 2023-12-26 18:51:08.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5511 …}
+nested: Doctrine\ORM\PersistentCollection {#5513 …}
+votes: Doctrine\ORM\PersistentCollection {#5515 …}
+reports: Doctrine\ORM\PersistentCollection {#5517 …}
+favourites: Doctrine\ORM\PersistentCollection {#5519 …}
+notifications: Doctrine\ORM\PersistentCollection {#5521 …}
-id: 254226
-bodyTs: "'also':41 'backward':32 'bashism':48 'command':69 'compat':33 'correspond':29 'distribut':16 'document':40 'egrep':10 'fgrep':11 'full':46 'gnu':1 'gnuism':49 'grep':2,27 'implement':6 'includ':9 'ism':53 'keep':57 'learn':36 'linux':50 'mani':20 'necessari':64 'offici':39 'option':30 'portabl':59 'provid':21 'realli':63 'rgrep':13 'run':26 'script':23,43 'shell':22 'simpli':25 'syntax':71 'tri':55 'unless':60 'unport':68 'use':66 'widespread':5 'year':15"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6891772"
+editedAt: null
+createdAt: DateTimeImmutable @1703613068 {#5509
date: 2023-12-26 18:51:08.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> GNU grep, the most widespread implementation, does not include egrep, fgrep and rgrep for years. Distributions (not all, but many) provide shell scripts that simply run grep with corresponding option for backward compatibility. You can learn this from official documentation.\n
\n
It seems you need to read the official documentation yourself. While it’s new information to me that `egrep` is no longer a symlink, as it used to be a couple of years ago, but a shell script wrapper to `grep -E` instead, the egrep command is to this day still provided by upstream GNU grep and is installed by default if you run `./configure; make; make install` from source. So it is not a backward compatibility hack provided by the distribution.\n
\n
You can check for yourself. Download the source from [ftp.gnu.org/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz), unpack and look for `src/egrep.sh` or line 1756 of `src/Makefile`. Apparently the change from symlink to shell script was done in 2014, and the deprecation warning was added only last year.\n
\n
In any case, my larger point is that the depreciation of `egrep` was a pointless and arbitrary decision that does not benefit users, especially not veterans like myself who have become accustomed to its presence. I don’t mind change, but let’s be honest, most people are not in the habit of checking the minutiae of every little command line utility they use, so a change like this violates the principle of least surprise. It’s one thing if things are changed with a good reason and the users do not only suffer the inconvenience of the change but get to reap the benefits of it as well, but so far I haven’t found any justification for it yet, nor can I think of any.\n
\n
So if there is a portability problem with using `egrep` now, it’s a *self-inflicted* portability problem that they caused by deprecating `egrep` in the first place.\n
\n
> Also, my scripts are not full of bashisms, gnuisms, linuxisms and other -isms, I try to keep them portable unless it is really necessary to use some unportable command or syntax.\n
\n
Good for you. Do you want a cookie or something?
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703616235 {#5545
date: 2023-12-26 19:43:55.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5549 …}
+nested: Doctrine\ORM\PersistentCollection {#5551 …}
+votes: Doctrine\ORM\PersistentCollection {#5553 …}
+reports: Doctrine\ORM\PersistentCollection {#5555 …}
+favourites: Doctrine\ORM\PersistentCollection {#5557 …}
+notifications: Doctrine\ORM\PersistentCollection {#5559 …}
-id: 254374
-bodyTs: "'/configure':105 '/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz),':134 '1756':142 '2014':156 'accustom':197 'ad':162 'ago':74 'also':322 'appar':145 'arbitrari':182 'backward':32,116 'bashism':329 'becom':196 'benefit':187,270 'case':168 'caus':314 'chang':147,205,232,248,264 'check':125,219 'command':86,225,350 'compat':33,117 'cooki':360 'correspond':29 'coupl':71 'day':90 'decis':183 'default':101 'deprec':159,316 'depreci':175 'distribut':16,122 'document':40,49 'done':154 'download':128 'e':82 'egrep':10,59,85,177,302,317 'especi':189 'everi':223 'far':277 'fgrep':11 'first':320 'found':281 'ftp.gnu.org':133 'ftp.gnu.org/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz),':132 'full':327 'get':266 'gnu':1,95 'gnuism':330 'good':251,353 'grep':2,27,81,96 'habit':217 'hack':118 'haven':279 'honest':210 'implement':6 'includ':9 'inconveni':261 'inflict':309 'inform':55 'instal':99,108 'instead':83 'ism':334 'justif':283 'keep':338 'larger':170 'last':164 'learn':36 'least':239 'let':207 'like':192,233 'line':141,226 'linux':331 'littl':224 'longer':62 'look':137 'make':106,107 'mani':20 'mind':204 'minutia':221 'necessari':345 'need':44 'new':54 'offici':39,48 'one':243 'option':30 'peopl':212 'place':321 'point':171 'pointless':180 'portabl':298,310,340 'presenc':200 'principl':237 'problem':299,311 'provid':21,92,119 'read':46 'realli':344 'reap':268 'reason':252 'rgrep':13 'run':26,104 'script':23,78,152,324 'seem':42 'self':308 'self-inflict':307 'shell':22,77,151 'simpli':25 'someth':362 'sourc':110,130 'src/egrep.sh':139 'src/makefile':144 'still':91 'suffer':259 'surpris':240 'symlink':64,149 'syntax':352 'thing':244,246 'think':290 'tri':336 'unless':341 'unpack':135 'unport':349 'upstream':94 'use':67,229,301,347 'user':188,255 'util':227 'veteran':191 'violat':235 'want':358 'warn':160 'well':274 'widespread':5 'wrapper':79 'year':15,73,165 'yet':286"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5578960"
+editedAt: DateTimeImmutable @1708050644 {#5546
date: 2024-02-16 03:30:44.0 +01:00
}
+createdAt: DateTimeImmutable @1703616235 {#5547
date: 2023-12-26 19:43:55.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> It seems you need to read the official documentation yourself.\n
\n
I did. [Debian man page](https://manpages.debian.org/bookworm/grep/grep.1.en.html), [GNU grep manual](https://www.gnu.org/software/grep/manual/html_node/Usage.html).\n
\n
I’m sorry for your loss, however the egrep deprecation is a fact. Of course you can continue using it as a veteran, but it is not correct to recommend this to beginners.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703620836 {#5583
date: 2023-12-26 21:00:36.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5586 …}
+nested: Doctrine\ORM\PersistentCollection {#5588 …}
+votes: Doctrine\ORM\PersistentCollection {#5590 …}
+reports: Doctrine\ORM\PersistentCollection {#5592 …}
+favourites: Doctrine\ORM\PersistentCollection {#5594 …}
+notifications: Doctrine\ORM\PersistentCollection {#5596 …}
-id: 254537
-bodyTs: "'/bookworm/grep/grep.1.en.html),':18 '/software/grep/manual/html_node/usage.html).':24 'beginn':57 'continu':42 'correct':52 'cours':39 'debian':13 'deprec':34 'document':9 'egrep':33 'fact':37 'gnu':19 'grep':20 'howev':31 'loss':30 'm':26 'man':14 'manpages.debian.org':17 'manpages.debian.org/bookworm/grep/grep.1.en.html),':16 'manual':21 'need':4 'offici':8 'page':15 'read':6 'recommend':54 'seem':2 'sorri':27 'use':43 'veteran':47 'www.gnu.org':23 'www.gnu.org/software/grep/manual/html_node/usage.html).':22"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6893637"
+editedAt: null
+createdAt: DateTimeImmutable @1703620836 {#5584
date: 2023-12-26 21:00:36.0 +01:00
}
} |
|
Show voter details
|
| 28 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5585
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5548
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5510
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5425
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4163
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
It is a great book, although a bit outdated. In particular, nowadays `egrep` is not recommended to use. `grep -E` is a more portable synonim.\n
\n
Some notes on you script:\n
\n
1. You don’t need to escape slashes in grep regex. In the sed `s///` command better use another character like `s###` so you also can leave slashes unescaped.\n
2. You usually don’t need to pipe `grep` and `sed`, `sed -n` with regex address and explicit printing command gives the same result as `grep`.\n
3. You could omit leading slash in your `egrep` regex, so you won’t need to remove it later.\n
\n
So I would do the same with\n
\n
```\n
\n
<span style="color:#323232;">tar -tzvf file.tar.gz | sed -En '/.(mp4|mkv)$/{s#^.*/##; s#.[.*##; s#[^a-zA-Z0-9()&-]# #g; s/ +/ /g; p}'\n
</span>\n
```
"""
+lang: "en"
+isAdult: false
+favouriteCount: 14
+score: 0
+lastActive: DateTime @1708114193 {#4164
date: 2024-02-16 21:09:53.0 +01:00
}
+ip: null
+tags: [
"323232"
]
+mentions: [
"@harsh3466@lemmy.world"
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4161 …}
+nested: Doctrine\ORM\PersistentCollection {#4159 …}
+votes: Doctrine\ORM\PersistentCollection {#4157 …}
+reports: Doctrine\ORM\PersistentCollection {#4154 …}
+favourites: Doctrine\ORM\PersistentCollection {#4150 …}
+notifications: Doctrine\ORM\PersistentCollection {#4148 …}
-id: 251438
-bodyTs: "'/g':129 '1':31 '2':60 '3':86 '9':126 'a-za-z0':122 'address':75 'also':55 'although':6 'anoth':49 'better':47 'bit':8 'book':5 'charact':50 'command':46,79 'could':88 'e':20 'egrep':13,94 'en':116 'escap':37 'explicit':77 'file.tar.gz':114 'g':127 'give':80 'great':4 'grep':19,40,68,85 'later':104 'lead':90 'leav':57 'like':51 'mkv':118 'mp4':117 'n':72 'need':35,65,100 'note':27 'nowaday':12 'omit':89 'outdat':9 'p':130 'particular':11 'pipe':67 'portabl':24 'print':78 'recommend':16 'regex':41,74,95 'remov':102 'result':83 'script':30 'sed':44,70,71,115 'slash':38,58,91 'synonim':25 'tar':112 'tzvf':113 'unescap':59 'use':18,48 'usual':62 'won':98 'would':107 'z0':125 'za':124"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6875297"
+editedAt: DateTimeImmutable @1707737027 {#4169
date: 2024-02-12 12:23:47.0 +01:00
}
+createdAt: DateTimeImmutable @1703524389 {#4167
date: 2023-12-25 18:13:09.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> nowadays egrep is not recommended to use. grep -E is a more portable synonim\n
\n
Not directed at you personally, but this is the kind of pointless pedantry from upstream developers that grinds my gears.\n
\n
Like, I’ve used `egrep` for 25 years. I don’t know of a still relevant Unix variant in existence that doesn’t have the `egrep` command. But suddenly now, when any other Unix variant but Linux is all but extinct, and all your shell scripts are probably full of bashisms and Linuxisms anyway, *now* there is somehow a portability problem, and they deem it necessary to print out a warning whenever I dare to run `egrep` instead of `grep -E`? C’mon now … If anything, they have just made it *less* portable by spitting out spurious warnings where there weren’t any before.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 8
+score: 0
+lastActive: DateTime @1703590646 {#5423
date: 2023-12-26 12:37:26.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
]
+children: Doctrine\ORM\PersistentCollection {#5427 …}
+nested: Doctrine\ORM\PersistentCollection {#5429 …}
+votes: Doctrine\ORM\PersistentCollection {#5431 …}
+reports: Doctrine\ORM\PersistentCollection {#5433 …}
+favourites: Doctrine\ORM\PersistentCollection {#5435 …}
+notifications: Doctrine\ORM\PersistentCollection {#5437 …}
-id: 253349
-bodyTs: "'25':41 'anyth':120 'anyway':88 'bashism':85 'c':116 'command':61 'dare':108 'deem':98 'develop':30 'direct':16 'doesn':56 'e':9,115 'egrep':2,39,60,111 'exist':54 'extinct':75 'full':83 'gear':34 'grep':8,114 'grind':32 'instead':112 'kind':24 'know':46 'less':126 'like':35 'linux':71,87 'made':124 'mon':117 'necessari':100 'nowaday':1 'pedantri':27 'person':19 'pointless':26 'portabl':13,94,127 'print':102 'probabl':82 'problem':95 'recommend':5 'relev':50 'run':110 'script':80 'shell':79 'somehow':92 'spit':129 'spurious':131 'still':49 'sudden':63 'synonim':14 'unix':51,68 'upstream':29 'use':7,38 'variant':52,69 've':37 'warn':105,132 'weren':135 'whenev':106 'year':42"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5573914"
+editedAt: null
+createdAt: DateTimeImmutable @1703590646 {#5424
date: 2023-12-26 12:37:26.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
GNU grep, the most widespread implementation, does not include `egrep`, `fgrep` and `rgrep` for years. Distributions (not all, but many) provide shell scripts that simply run `grep` with corresponding option for backward compatibility. You can learn this from official documentation.\n
\n
Also, *my* scripts are not full of bashisms, gnuisms, linuxisms and other -isms, I try to keep them portable unless it is really necessary to use some unportable command or syntax.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703613068 {#5508
date: 2023-12-26 18:51:08.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5511 …}
+nested: Doctrine\ORM\PersistentCollection {#5513 …}
+votes: Doctrine\ORM\PersistentCollection {#5515 …}
+reports: Doctrine\ORM\PersistentCollection {#5517 …}
+favourites: Doctrine\ORM\PersistentCollection {#5519 …}
+notifications: Doctrine\ORM\PersistentCollection {#5521 …}
-id: 254226
-bodyTs: "'also':41 'backward':32 'bashism':48 'command':69 'compat':33 'correspond':29 'distribut':16 'document':40 'egrep':10 'fgrep':11 'full':46 'gnu':1 'gnuism':49 'grep':2,27 'implement':6 'includ':9 'ism':53 'keep':57 'learn':36 'linux':50 'mani':20 'necessari':64 'offici':39 'option':30 'portabl':59 'provid':21 'realli':63 'rgrep':13 'run':26 'script':23,43 'shell':22 'simpli':25 'syntax':71 'tri':55 'unless':60 'unport':68 'use':66 'widespread':5 'year':15"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6891772"
+editedAt: null
+createdAt: DateTimeImmutable @1703613068 {#5509
date: 2023-12-26 18:51:08.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> GNU grep, the most widespread implementation, does not include egrep, fgrep and rgrep for years. Distributions (not all, but many) provide shell scripts that simply run grep with corresponding option for backward compatibility. You can learn this from official documentation.\n
\n
It seems you need to read the official documentation yourself. While it’s new information to me that `egrep` is no longer a symlink, as it used to be a couple of years ago, but a shell script wrapper to `grep -E` instead, the egrep command is to this day still provided by upstream GNU grep and is installed by default if you run `./configure; make; make install` from source. So it is not a backward compatibility hack provided by the distribution.\n
\n
You can check for yourself. Download the source from [ftp.gnu.org/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz), unpack and look for `src/egrep.sh` or line 1756 of `src/Makefile`. Apparently the change from symlink to shell script was done in 2014, and the deprecation warning was added only last year.\n
\n
In any case, my larger point is that the depreciation of `egrep` was a pointless and arbitrary decision that does not benefit users, especially not veterans like myself who have become accustomed to its presence. I don’t mind change, but let’s be honest, most people are not in the habit of checking the minutiae of every little command line utility they use, so a change like this violates the principle of least surprise. It’s one thing if things are changed with a good reason and the users do not only suffer the inconvenience of the change but get to reap the benefits of it as well, but so far I haven’t found any justification for it yet, nor can I think of any.\n
\n
So if there is a portability problem with using `egrep` now, it’s a *self-inflicted* portability problem that they caused by deprecating `egrep` in the first place.\n
\n
> Also, my scripts are not full of bashisms, gnuisms, linuxisms and other -isms, I try to keep them portable unless it is really necessary to use some unportable command or syntax.\n
\n
Good for you. Do you want a cookie or something?
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703616235 {#5545
date: 2023-12-26 19:43:55.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5549 …}
+nested: Doctrine\ORM\PersistentCollection {#5551 …}
+votes: Doctrine\ORM\PersistentCollection {#5553 …}
+reports: Doctrine\ORM\PersistentCollection {#5555 …}
+favourites: Doctrine\ORM\PersistentCollection {#5557 …}
+notifications: Doctrine\ORM\PersistentCollection {#5559 …}
-id: 254374
-bodyTs: "'/configure':105 '/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz),':134 '1756':142 '2014':156 'accustom':197 'ad':162 'ago':74 'also':322 'appar':145 'arbitrari':182 'backward':32,116 'bashism':329 'becom':196 'benefit':187,270 'case':168 'caus':314 'chang':147,205,232,248,264 'check':125,219 'command':86,225,350 'compat':33,117 'cooki':360 'correspond':29 'coupl':71 'day':90 'decis':183 'default':101 'deprec':159,316 'depreci':175 'distribut':16,122 'document':40,49 'done':154 'download':128 'e':82 'egrep':10,59,85,177,302,317 'especi':189 'everi':223 'far':277 'fgrep':11 'first':320 'found':281 'ftp.gnu.org':133 'ftp.gnu.org/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz),':132 'full':327 'get':266 'gnu':1,95 'gnuism':330 'good':251,353 'grep':2,27,81,96 'habit':217 'hack':118 'haven':279 'honest':210 'implement':6 'includ':9 'inconveni':261 'inflict':309 'inform':55 'instal':99,108 'instead':83 'ism':334 'justif':283 'keep':338 'larger':170 'last':164 'learn':36 'least':239 'let':207 'like':192,233 'line':141,226 'linux':331 'littl':224 'longer':62 'look':137 'make':106,107 'mani':20 'mind':204 'minutia':221 'necessari':345 'need':44 'new':54 'offici':39,48 'one':243 'option':30 'peopl':212 'place':321 'point':171 'pointless':180 'portabl':298,310,340 'presenc':200 'principl':237 'problem':299,311 'provid':21,92,119 'read':46 'realli':344 'reap':268 'reason':252 'rgrep':13 'run':26,104 'script':23,78,152,324 'seem':42 'self':308 'self-inflict':307 'shell':22,77,151 'simpli':25 'someth':362 'sourc':110,130 'src/egrep.sh':139 'src/makefile':144 'still':91 'suffer':259 'surpris':240 'symlink':64,149 'syntax':352 'thing':244,246 'think':290 'tri':336 'unless':341 'unpack':135 'unport':349 'upstream':94 'use':67,229,301,347 'user':188,255 'util':227 'veteran':191 'violat':235 'want':358 'warn':160 'well':274 'widespread':5 'wrapper':79 'year':15,73,165 'yet':286"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5578960"
+editedAt: DateTimeImmutable @1708050644 {#5546
date: 2024-02-16 03:30:44.0 +01:00
}
+createdAt: DateTimeImmutable @1703616235 {#5547
date: 2023-12-26 19:43:55.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> It seems you need to read the official documentation yourself.\n
\n
I did. [Debian man page](https://manpages.debian.org/bookworm/grep/grep.1.en.html), [GNU grep manual](https://www.gnu.org/software/grep/manual/html_node/Usage.html).\n
\n
I’m sorry for your loss, however the egrep deprecation is a fact. Of course you can continue using it as a veteran, but it is not correct to recommend this to beginners.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703620836 {#5583
date: 2023-12-26 21:00:36.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5586 …}
+nested: Doctrine\ORM\PersistentCollection {#5588 …}
+votes: Doctrine\ORM\PersistentCollection {#5590 …}
+reports: Doctrine\ORM\PersistentCollection {#5592 …}
+favourites: Doctrine\ORM\PersistentCollection {#5594 …}
+notifications: Doctrine\ORM\PersistentCollection {#5596 …}
-id: 254537
-bodyTs: "'/bookworm/grep/grep.1.en.html),':18 '/software/grep/manual/html_node/usage.html).':24 'beginn':57 'continu':42 'correct':52 'cours':39 'debian':13 'deprec':34 'document':9 'egrep':33 'fact':37 'gnu':19 'grep':20 'howev':31 'loss':30 'm':26 'man':14 'manpages.debian.org':17 'manpages.debian.org/bookworm/grep/grep.1.en.html),':16 'manual':21 'need':4 'offici':8 'page':15 'read':6 'recommend':54 'seem':2 'sorri':27 'use':43 'veteran':47 'www.gnu.org':23 'www.gnu.org/software/grep/manual/html_node/usage.html).':22"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6893637"
+editedAt: null
+createdAt: DateTimeImmutable @1703620836 {#5584
date: 2023-12-26 21:00:36.0 +01:00
}
} |
|
Show voter details
|
| 29 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 30 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5621
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5585
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5548
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5510
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5425
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4163
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
It is a great book, although a bit outdated. In particular, nowadays `egrep` is not recommended to use. `grep -E` is a more portable synonim.\n
\n
Some notes on you script:\n
\n
1. You don’t need to escape slashes in grep regex. In the sed `s///` command better use another character like `s###` so you also can leave slashes unescaped.\n
2. You usually don’t need to pipe `grep` and `sed`, `sed -n` with regex address and explicit printing command gives the same result as `grep`.\n
3. You could omit leading slash in your `egrep` regex, so you won’t need to remove it later.\n
\n
So I would do the same with\n
\n
```\n
\n
<span style="color:#323232;">tar -tzvf file.tar.gz | sed -En '/.(mp4|mkv)$/{s#^.*/##; s#.[.*##; s#[^a-zA-Z0-9()&-]# #g; s/ +/ /g; p}'\n
</span>\n
```
"""
+lang: "en"
+isAdult: false
+favouriteCount: 14
+score: 0
+lastActive: DateTime @1708114193 {#4164
date: 2024-02-16 21:09:53.0 +01:00
}
+ip: null
+tags: [
"323232"
]
+mentions: [
"@harsh3466@lemmy.world"
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4161 …}
+nested: Doctrine\ORM\PersistentCollection {#4159 …}
+votes: Doctrine\ORM\PersistentCollection {#4157 …}
+reports: Doctrine\ORM\PersistentCollection {#4154 …}
+favourites: Doctrine\ORM\PersistentCollection {#4150 …}
+notifications: Doctrine\ORM\PersistentCollection {#4148 …}
-id: 251438
-bodyTs: "'/g':129 '1':31 '2':60 '3':86 '9':126 'a-za-z0':122 'address':75 'also':55 'although':6 'anoth':49 'better':47 'bit':8 'book':5 'charact':50 'command':46,79 'could':88 'e':20 'egrep':13,94 'en':116 'escap':37 'explicit':77 'file.tar.gz':114 'g':127 'give':80 'great':4 'grep':19,40,68,85 'later':104 'lead':90 'leav':57 'like':51 'mkv':118 'mp4':117 'n':72 'need':35,65,100 'note':27 'nowaday':12 'omit':89 'outdat':9 'p':130 'particular':11 'pipe':67 'portabl':24 'print':78 'recommend':16 'regex':41,74,95 'remov':102 'result':83 'script':30 'sed':44,70,71,115 'slash':38,58,91 'synonim':25 'tar':112 'tzvf':113 'unescap':59 'use':18,48 'usual':62 'won':98 'would':107 'z0':125 'za':124"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6875297"
+editedAt: DateTimeImmutable @1707737027 {#4169
date: 2024-02-12 12:23:47.0 +01:00
}
+createdAt: DateTimeImmutable @1703524389 {#4167
date: 2023-12-25 18:13:09.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> nowadays egrep is not recommended to use. grep -E is a more portable synonim\n
\n
Not directed at you personally, but this is the kind of pointless pedantry from upstream developers that grinds my gears.\n
\n
Like, I’ve used `egrep` for 25 years. I don’t know of a still relevant Unix variant in existence that doesn’t have the `egrep` command. But suddenly now, when any other Unix variant but Linux is all but extinct, and all your shell scripts are probably full of bashisms and Linuxisms anyway, *now* there is somehow a portability problem, and they deem it necessary to print out a warning whenever I dare to run `egrep` instead of `grep -E`? C’mon now … If anything, they have just made it *less* portable by spitting out spurious warnings where there weren’t any before.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 8
+score: 0
+lastActive: DateTime @1703590646 {#5423
date: 2023-12-26 12:37:26.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
]
+children: Doctrine\ORM\PersistentCollection {#5427 …}
+nested: Doctrine\ORM\PersistentCollection {#5429 …}
+votes: Doctrine\ORM\PersistentCollection {#5431 …}
+reports: Doctrine\ORM\PersistentCollection {#5433 …}
+favourites: Doctrine\ORM\PersistentCollection {#5435 …}
+notifications: Doctrine\ORM\PersistentCollection {#5437 …}
-id: 253349
-bodyTs: "'25':41 'anyth':120 'anyway':88 'bashism':85 'c':116 'command':61 'dare':108 'deem':98 'develop':30 'direct':16 'doesn':56 'e':9,115 'egrep':2,39,60,111 'exist':54 'extinct':75 'full':83 'gear':34 'grep':8,114 'grind':32 'instead':112 'kind':24 'know':46 'less':126 'like':35 'linux':71,87 'made':124 'mon':117 'necessari':100 'nowaday':1 'pedantri':27 'person':19 'pointless':26 'portabl':13,94,127 'print':102 'probabl':82 'problem':95 'recommend':5 'relev':50 'run':110 'script':80 'shell':79 'somehow':92 'spit':129 'spurious':131 'still':49 'sudden':63 'synonim':14 'unix':51,68 'upstream':29 'use':7,38 'variant':52,69 've':37 'warn':105,132 'weren':135 'whenev':106 'year':42"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5573914"
+editedAt: null
+createdAt: DateTimeImmutable @1703590646 {#5424
date: 2023-12-26 12:37:26.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
GNU grep, the most widespread implementation, does not include `egrep`, `fgrep` and `rgrep` for years. Distributions (not all, but many) provide shell scripts that simply run `grep` with corresponding option for backward compatibility. You can learn this from official documentation.\n
\n
Also, *my* scripts are not full of bashisms, gnuisms, linuxisms and other -isms, I try to keep them portable unless it is really necessary to use some unportable command or syntax.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703613068 {#5508
date: 2023-12-26 18:51:08.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5511 …}
+nested: Doctrine\ORM\PersistentCollection {#5513 …}
+votes: Doctrine\ORM\PersistentCollection {#5515 …}
+reports: Doctrine\ORM\PersistentCollection {#5517 …}
+favourites: Doctrine\ORM\PersistentCollection {#5519 …}
+notifications: Doctrine\ORM\PersistentCollection {#5521 …}
-id: 254226
-bodyTs: "'also':41 'backward':32 'bashism':48 'command':69 'compat':33 'correspond':29 'distribut':16 'document':40 'egrep':10 'fgrep':11 'full':46 'gnu':1 'gnuism':49 'grep':2,27 'implement':6 'includ':9 'ism':53 'keep':57 'learn':36 'linux':50 'mani':20 'necessari':64 'offici':39 'option':30 'portabl':59 'provid':21 'realli':63 'rgrep':13 'run':26 'script':23,43 'shell':22 'simpli':25 'syntax':71 'tri':55 'unless':60 'unport':68 'use':66 'widespread':5 'year':15"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6891772"
+editedAt: null
+createdAt: DateTimeImmutable @1703613068 {#5509
date: 2023-12-26 18:51:08.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> GNU grep, the most widespread implementation, does not include egrep, fgrep and rgrep for years. Distributions (not all, but many) provide shell scripts that simply run grep with corresponding option for backward compatibility. You can learn this from official documentation.\n
\n
It seems you need to read the official documentation yourself. While it’s new information to me that `egrep` is no longer a symlink, as it used to be a couple of years ago, but a shell script wrapper to `grep -E` instead, the egrep command is to this day still provided by upstream GNU grep and is installed by default if you run `./configure; make; make install` from source. So it is not a backward compatibility hack provided by the distribution.\n
\n
You can check for yourself. Download the source from [ftp.gnu.org/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz), unpack and look for `src/egrep.sh` or line 1756 of `src/Makefile`. Apparently the change from symlink to shell script was done in 2014, and the deprecation warning was added only last year.\n
\n
In any case, my larger point is that the depreciation of `egrep` was a pointless and arbitrary decision that does not benefit users, especially not veterans like myself who have become accustomed to its presence. I don’t mind change, but let’s be honest, most people are not in the habit of checking the minutiae of every little command line utility they use, so a change like this violates the principle of least surprise. It’s one thing if things are changed with a good reason and the users do not only suffer the inconvenience of the change but get to reap the benefits of it as well, but so far I haven’t found any justification for it yet, nor can I think of any.\n
\n
So if there is a portability problem with using `egrep` now, it’s a *self-inflicted* portability problem that they caused by deprecating `egrep` in the first place.\n
\n
> Also, my scripts are not full of bashisms, gnuisms, linuxisms and other -isms, I try to keep them portable unless it is really necessary to use some unportable command or syntax.\n
\n
Good for you. Do you want a cookie or something?
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703616235 {#5545
date: 2023-12-26 19:43:55.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5549 …}
+nested: Doctrine\ORM\PersistentCollection {#5551 …}
+votes: Doctrine\ORM\PersistentCollection {#5553 …}
+reports: Doctrine\ORM\PersistentCollection {#5555 …}
+favourites: Doctrine\ORM\PersistentCollection {#5557 …}
+notifications: Doctrine\ORM\PersistentCollection {#5559 …}
-id: 254374
-bodyTs: "'/configure':105 '/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz),':134 '1756':142 '2014':156 'accustom':197 'ad':162 'ago':74 'also':322 'appar':145 'arbitrari':182 'backward':32,116 'bashism':329 'becom':196 'benefit':187,270 'case':168 'caus':314 'chang':147,205,232,248,264 'check':125,219 'command':86,225,350 'compat':33,117 'cooki':360 'correspond':29 'coupl':71 'day':90 'decis':183 'default':101 'deprec':159,316 'depreci':175 'distribut':16,122 'document':40,49 'done':154 'download':128 'e':82 'egrep':10,59,85,177,302,317 'especi':189 'everi':223 'far':277 'fgrep':11 'first':320 'found':281 'ftp.gnu.org':133 'ftp.gnu.org/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz),':132 'full':327 'get':266 'gnu':1,95 'gnuism':330 'good':251,353 'grep':2,27,81,96 'habit':217 'hack':118 'haven':279 'honest':210 'implement':6 'includ':9 'inconveni':261 'inflict':309 'inform':55 'instal':99,108 'instead':83 'ism':334 'justif':283 'keep':338 'larger':170 'last':164 'learn':36 'least':239 'let':207 'like':192,233 'line':141,226 'linux':331 'littl':224 'longer':62 'look':137 'make':106,107 'mani':20 'mind':204 'minutia':221 'necessari':345 'need':44 'new':54 'offici':39,48 'one':243 'option':30 'peopl':212 'place':321 'point':171 'pointless':180 'portabl':298,310,340 'presenc':200 'principl':237 'problem':299,311 'provid':21,92,119 'read':46 'realli':344 'reap':268 'reason':252 'rgrep':13 'run':26,104 'script':23,78,152,324 'seem':42 'self':308 'self-inflict':307 'shell':22,77,151 'simpli':25 'someth':362 'sourc':110,130 'src/egrep.sh':139 'src/makefile':144 'still':91 'suffer':259 'surpris':240 'symlink':64,149 'syntax':352 'thing':244,246 'think':290 'tri':336 'unless':341 'unpack':135 'unport':349 'upstream':94 'use':67,229,301,347 'user':188,255 'util':227 'veteran':191 'violat':235 'want':358 'warn':160 'well':274 'widespread':5 'wrapper':79 'year':15,73,165 'yet':286"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5578960"
+editedAt: DateTimeImmutable @1708050644 {#5546
date: 2024-02-16 03:30:44.0 +01:00
}
+createdAt: DateTimeImmutable @1703616235 {#5547
date: 2023-12-26 19:43:55.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> It seems you need to read the official documentation yourself.\n
\n
I did. [Debian man page](https://manpages.debian.org/bookworm/grep/grep.1.en.html), [GNU grep manual](https://www.gnu.org/software/grep/manual/html_node/Usage.html).\n
\n
I’m sorry for your loss, however the egrep deprecation is a fact. Of course you can continue using it as a veteran, but it is not correct to recommend this to beginners.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703620836 {#5583
date: 2023-12-26 21:00:36.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5586 …}
+nested: Doctrine\ORM\PersistentCollection {#5588 …}
+votes: Doctrine\ORM\PersistentCollection {#5590 …}
+reports: Doctrine\ORM\PersistentCollection {#5592 …}
+favourites: Doctrine\ORM\PersistentCollection {#5594 …}
+notifications: Doctrine\ORM\PersistentCollection {#5596 …}
-id: 254537
-bodyTs: "'/bookworm/grep/grep.1.en.html),':18 '/software/grep/manual/html_node/usage.html).':24 'beginn':57 'continu':42 'correct':52 'cours':39 'debian':13 'deprec':34 'document':9 'egrep':33 'fact':37 'gnu':19 'grep':20 'howev':31 'loss':30 'm':26 'man':14 'manpages.debian.org':17 'manpages.debian.org/bookworm/grep/grep.1.en.html),':16 'manual':21 'need':4 'offici':8 'page':15 'read':6 'recommend':54 'seem':2 'sorri':27 'use':43 'veteran':47 'www.gnu.org':23 'www.gnu.org/software/grep/manual/html_node/usage.html).':22"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6893637"
+editedAt: null
+createdAt: DateTimeImmutable @1703620836 {#5584
date: 2023-12-26 21:00:36.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
You are strawmanning, and your links are not countering any point I made. I never disputed the depreciation as fact, and I never recommended that beginners should use `egrep` over `grep -E`\n
\n
I disputed your claims that the `egrep` command has *just* been a distro hack all these years, when in fact GNU to this day still distributes `egrep` through its source tarballs and only very recently started to warn about it through the wrapper script. And again, the only “portability problem” here is the fact that they deprecated it in the first place, i.e. a self-inflicted one.\n
\n
Then as a Linux and Unix veteran I gave my subjective opinion by lamenting and criticizing the fact that this depreciation happened, and how changes like this always feel like unnecessary pedantry to me. Yes it’s an expression of frustration, but I am allowed to feel frustrated about it. I don’t need people like you invalidating how I feel about breaking changes in software that I use daily.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703622566 {#5625
date: 2023-12-26 21:29:26.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5618 …}
+nested: Doctrine\ORM\PersistentCollection {#5616 …}
+votes: Doctrine\ORM\PersistentCollection {#5620 …}
+reports: Doctrine\ORM\PersistentCollection {#5631 …}
+favourites: Doctrine\ORM\PersistentCollection {#5633 …}
+notifications: Doctrine\ORM\PersistentCollection {#5635 …}
-id: 254615
-bodyTs: "'allow':145 'alway':128 'beginn':26 'break':163 'chang':125,164 'claim':36 'command':40 'counter':9 'critic':116 'daili':170 'day':56 'deprec':89 'depreci':18,121 'disput':16,34 'distribut':58 'distro':45 'e':32 'egrep':29,39,59 'express':139 'fact':20,52,86,118 'feel':129,147,161 'first':93 'frustrat':141,148 'gave':109 'gnu':53 'grep':31 'hack':46 'happen':122 'i.e':95 'inflict':99 'invalid':158 'lament':114 'like':126,130,156 'link':6 'linux':104 'made':13 'need':154 'never':15,23 'one':100 'opinion':112 'pedantri':132 'peopl':155 'place':94 'point':11 'portabl':81 'problem':82 'recent':67 'recommend':24 'script':76 'self':98 'self-inflict':97 'softwar':166 'sourc':62 'start':68 'still':57 'strawman':3 'subject':111 'tarbal':63 'unix':106 'unnecessari':131 'use':28,169 'veteran':107 'warn':70 'wrapper':75 'year':49 'yes':135"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5580375"
+editedAt: DateTimeImmutable @1708090237 {#5628
date: 2024-02-16 14:30:37.0 +01:00
}
+createdAt: DateTimeImmutable @1703622566 {#5624
date: 2023-12-26 21:29:26.0 +01:00
}
} |
|
Show voter details
|
| 31 |
DENIED
|
edit
|
App\Entity\EntryComment {#5621
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5585
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5548
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5510
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5425
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4163
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
It is a great book, although a bit outdated. In particular, nowadays `egrep` is not recommended to use. `grep -E` is a more portable synonim.\n
\n
Some notes on you script:\n
\n
1. You don’t need to escape slashes in grep regex. In the sed `s///` command better use another character like `s###` so you also can leave slashes unescaped.\n
2. You usually don’t need to pipe `grep` and `sed`, `sed -n` with regex address and explicit printing command gives the same result as `grep`.\n
3. You could omit leading slash in your `egrep` regex, so you won’t need to remove it later.\n
\n
So I would do the same with\n
\n
```\n
\n
<span style="color:#323232;">tar -tzvf file.tar.gz | sed -En '/.(mp4|mkv)$/{s#^.*/##; s#.[.*##; s#[^a-zA-Z0-9()&-]# #g; s/ +/ /g; p}'\n
</span>\n
```
"""
+lang: "en"
+isAdult: false
+favouriteCount: 14
+score: 0
+lastActive: DateTime @1708114193 {#4164
date: 2024-02-16 21:09:53.0 +01:00
}
+ip: null
+tags: [
"323232"
]
+mentions: [
"@harsh3466@lemmy.world"
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4161 …}
+nested: Doctrine\ORM\PersistentCollection {#4159 …}
+votes: Doctrine\ORM\PersistentCollection {#4157 …}
+reports: Doctrine\ORM\PersistentCollection {#4154 …}
+favourites: Doctrine\ORM\PersistentCollection {#4150 …}
+notifications: Doctrine\ORM\PersistentCollection {#4148 …}
-id: 251438
-bodyTs: "'/g':129 '1':31 '2':60 '3':86 '9':126 'a-za-z0':122 'address':75 'also':55 'although':6 'anoth':49 'better':47 'bit':8 'book':5 'charact':50 'command':46,79 'could':88 'e':20 'egrep':13,94 'en':116 'escap':37 'explicit':77 'file.tar.gz':114 'g':127 'give':80 'great':4 'grep':19,40,68,85 'later':104 'lead':90 'leav':57 'like':51 'mkv':118 'mp4':117 'n':72 'need':35,65,100 'note':27 'nowaday':12 'omit':89 'outdat':9 'p':130 'particular':11 'pipe':67 'portabl':24 'print':78 'recommend':16 'regex':41,74,95 'remov':102 'result':83 'script':30 'sed':44,70,71,115 'slash':38,58,91 'synonim':25 'tar':112 'tzvf':113 'unescap':59 'use':18,48 'usual':62 'won':98 'would':107 'z0':125 'za':124"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6875297"
+editedAt: DateTimeImmutable @1707737027 {#4169
date: 2024-02-12 12:23:47.0 +01:00
}
+createdAt: DateTimeImmutable @1703524389 {#4167
date: 2023-12-25 18:13:09.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> nowadays egrep is not recommended to use. grep -E is a more portable synonim\n
\n
Not directed at you personally, but this is the kind of pointless pedantry from upstream developers that grinds my gears.\n
\n
Like, I’ve used `egrep` for 25 years. I don’t know of a still relevant Unix variant in existence that doesn’t have the `egrep` command. But suddenly now, when any other Unix variant but Linux is all but extinct, and all your shell scripts are probably full of bashisms and Linuxisms anyway, *now* there is somehow a portability problem, and they deem it necessary to print out a warning whenever I dare to run `egrep` instead of `grep -E`? C’mon now … If anything, they have just made it *less* portable by spitting out spurious warnings where there weren’t any before.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 8
+score: 0
+lastActive: DateTime @1703590646 {#5423
date: 2023-12-26 12:37:26.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
]
+children: Doctrine\ORM\PersistentCollection {#5427 …}
+nested: Doctrine\ORM\PersistentCollection {#5429 …}
+votes: Doctrine\ORM\PersistentCollection {#5431 …}
+reports: Doctrine\ORM\PersistentCollection {#5433 …}
+favourites: Doctrine\ORM\PersistentCollection {#5435 …}
+notifications: Doctrine\ORM\PersistentCollection {#5437 …}
-id: 253349
-bodyTs: "'25':41 'anyth':120 'anyway':88 'bashism':85 'c':116 'command':61 'dare':108 'deem':98 'develop':30 'direct':16 'doesn':56 'e':9,115 'egrep':2,39,60,111 'exist':54 'extinct':75 'full':83 'gear':34 'grep':8,114 'grind':32 'instead':112 'kind':24 'know':46 'less':126 'like':35 'linux':71,87 'made':124 'mon':117 'necessari':100 'nowaday':1 'pedantri':27 'person':19 'pointless':26 'portabl':13,94,127 'print':102 'probabl':82 'problem':95 'recommend':5 'relev':50 'run':110 'script':80 'shell':79 'somehow':92 'spit':129 'spurious':131 'still':49 'sudden':63 'synonim':14 'unix':51,68 'upstream':29 'use':7,38 'variant':52,69 've':37 'warn':105,132 'weren':135 'whenev':106 'year':42"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5573914"
+editedAt: null
+createdAt: DateTimeImmutable @1703590646 {#5424
date: 2023-12-26 12:37:26.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
GNU grep, the most widespread implementation, does not include `egrep`, `fgrep` and `rgrep` for years. Distributions (not all, but many) provide shell scripts that simply run `grep` with corresponding option for backward compatibility. You can learn this from official documentation.\n
\n
Also, *my* scripts are not full of bashisms, gnuisms, linuxisms and other -isms, I try to keep them portable unless it is really necessary to use some unportable command or syntax.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703613068 {#5508
date: 2023-12-26 18:51:08.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5511 …}
+nested: Doctrine\ORM\PersistentCollection {#5513 …}
+votes: Doctrine\ORM\PersistentCollection {#5515 …}
+reports: Doctrine\ORM\PersistentCollection {#5517 …}
+favourites: Doctrine\ORM\PersistentCollection {#5519 …}
+notifications: Doctrine\ORM\PersistentCollection {#5521 …}
-id: 254226
-bodyTs: "'also':41 'backward':32 'bashism':48 'command':69 'compat':33 'correspond':29 'distribut':16 'document':40 'egrep':10 'fgrep':11 'full':46 'gnu':1 'gnuism':49 'grep':2,27 'implement':6 'includ':9 'ism':53 'keep':57 'learn':36 'linux':50 'mani':20 'necessari':64 'offici':39 'option':30 'portabl':59 'provid':21 'realli':63 'rgrep':13 'run':26 'script':23,43 'shell':22 'simpli':25 'syntax':71 'tri':55 'unless':60 'unport':68 'use':66 'widespread':5 'year':15"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6891772"
+editedAt: null
+createdAt: DateTimeImmutable @1703613068 {#5509
date: 2023-12-26 18:51:08.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> GNU grep, the most widespread implementation, does not include egrep, fgrep and rgrep for years. Distributions (not all, but many) provide shell scripts that simply run grep with corresponding option for backward compatibility. You can learn this from official documentation.\n
\n
It seems you need to read the official documentation yourself. While it’s new information to me that `egrep` is no longer a symlink, as it used to be a couple of years ago, but a shell script wrapper to `grep -E` instead, the egrep command is to this day still provided by upstream GNU grep and is installed by default if you run `./configure; make; make install` from source. So it is not a backward compatibility hack provided by the distribution.\n
\n
You can check for yourself. Download the source from [ftp.gnu.org/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz), unpack and look for `src/egrep.sh` or line 1756 of `src/Makefile`. Apparently the change from symlink to shell script was done in 2014, and the deprecation warning was added only last year.\n
\n
In any case, my larger point is that the depreciation of `egrep` was a pointless and arbitrary decision that does not benefit users, especially not veterans like myself who have become accustomed to its presence. I don’t mind change, but let’s be honest, most people are not in the habit of checking the minutiae of every little command line utility they use, so a change like this violates the principle of least surprise. It’s one thing if things are changed with a good reason and the users do not only suffer the inconvenience of the change but get to reap the benefits of it as well, but so far I haven’t found any justification for it yet, nor can I think of any.\n
\n
So if there is a portability problem with using `egrep` now, it’s a *self-inflicted* portability problem that they caused by deprecating `egrep` in the first place.\n
\n
> Also, my scripts are not full of bashisms, gnuisms, linuxisms and other -isms, I try to keep them portable unless it is really necessary to use some unportable command or syntax.\n
\n
Good for you. Do you want a cookie or something?
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703616235 {#5545
date: 2023-12-26 19:43:55.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5549 …}
+nested: Doctrine\ORM\PersistentCollection {#5551 …}
+votes: Doctrine\ORM\PersistentCollection {#5553 …}
+reports: Doctrine\ORM\PersistentCollection {#5555 …}
+favourites: Doctrine\ORM\PersistentCollection {#5557 …}
+notifications: Doctrine\ORM\PersistentCollection {#5559 …}
-id: 254374
-bodyTs: "'/configure':105 '/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz),':134 '1756':142 '2014':156 'accustom':197 'ad':162 'ago':74 'also':322 'appar':145 'arbitrari':182 'backward':32,116 'bashism':329 'becom':196 'benefit':187,270 'case':168 'caus':314 'chang':147,205,232,248,264 'check':125,219 'command':86,225,350 'compat':33,117 'cooki':360 'correspond':29 'coupl':71 'day':90 'decis':183 'default':101 'deprec':159,316 'depreci':175 'distribut':16,122 'document':40,49 'done':154 'download':128 'e':82 'egrep':10,59,85,177,302,317 'especi':189 'everi':223 'far':277 'fgrep':11 'first':320 'found':281 'ftp.gnu.org':133 'ftp.gnu.org/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz),':132 'full':327 'get':266 'gnu':1,95 'gnuism':330 'good':251,353 'grep':2,27,81,96 'habit':217 'hack':118 'haven':279 'honest':210 'implement':6 'includ':9 'inconveni':261 'inflict':309 'inform':55 'instal':99,108 'instead':83 'ism':334 'justif':283 'keep':338 'larger':170 'last':164 'learn':36 'least':239 'let':207 'like':192,233 'line':141,226 'linux':331 'littl':224 'longer':62 'look':137 'make':106,107 'mani':20 'mind':204 'minutia':221 'necessari':345 'need':44 'new':54 'offici':39,48 'one':243 'option':30 'peopl':212 'place':321 'point':171 'pointless':180 'portabl':298,310,340 'presenc':200 'principl':237 'problem':299,311 'provid':21,92,119 'read':46 'realli':344 'reap':268 'reason':252 'rgrep':13 'run':26,104 'script':23,78,152,324 'seem':42 'self':308 'self-inflict':307 'shell':22,77,151 'simpli':25 'someth':362 'sourc':110,130 'src/egrep.sh':139 'src/makefile':144 'still':91 'suffer':259 'surpris':240 'symlink':64,149 'syntax':352 'thing':244,246 'think':290 'tri':336 'unless':341 'unpack':135 'unport':349 'upstream':94 'use':67,229,301,347 'user':188,255 'util':227 'veteran':191 'violat':235 'want':358 'warn':160 'well':274 'widespread':5 'wrapper':79 'year':15,73,165 'yet':286"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5578960"
+editedAt: DateTimeImmutable @1708050644 {#5546
date: 2024-02-16 03:30:44.0 +01:00
}
+createdAt: DateTimeImmutable @1703616235 {#5547
date: 2023-12-26 19:43:55.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> It seems you need to read the official documentation yourself.\n
\n
I did. [Debian man page](https://manpages.debian.org/bookworm/grep/grep.1.en.html), [GNU grep manual](https://www.gnu.org/software/grep/manual/html_node/Usage.html).\n
\n
I’m sorry for your loss, however the egrep deprecation is a fact. Of course you can continue using it as a veteran, but it is not correct to recommend this to beginners.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703620836 {#5583
date: 2023-12-26 21:00:36.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5586 …}
+nested: Doctrine\ORM\PersistentCollection {#5588 …}
+votes: Doctrine\ORM\PersistentCollection {#5590 …}
+reports: Doctrine\ORM\PersistentCollection {#5592 …}
+favourites: Doctrine\ORM\PersistentCollection {#5594 …}
+notifications: Doctrine\ORM\PersistentCollection {#5596 …}
-id: 254537
-bodyTs: "'/bookworm/grep/grep.1.en.html),':18 '/software/grep/manual/html_node/usage.html).':24 'beginn':57 'continu':42 'correct':52 'cours':39 'debian':13 'deprec':34 'document':9 'egrep':33 'fact':37 'gnu':19 'grep':20 'howev':31 'loss':30 'm':26 'man':14 'manpages.debian.org':17 'manpages.debian.org/bookworm/grep/grep.1.en.html),':16 'manual':21 'need':4 'offici':8 'page':15 'read':6 'recommend':54 'seem':2 'sorri':27 'use':43 'veteran':47 'www.gnu.org':23 'www.gnu.org/software/grep/manual/html_node/usage.html).':22"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6893637"
+editedAt: null
+createdAt: DateTimeImmutable @1703620836 {#5584
date: 2023-12-26 21:00:36.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
You are strawmanning, and your links are not countering any point I made. I never disputed the depreciation as fact, and I never recommended that beginners should use `egrep` over `grep -E`\n
\n
I disputed your claims that the `egrep` command has *just* been a distro hack all these years, when in fact GNU to this day still distributes `egrep` through its source tarballs and only very recently started to warn about it through the wrapper script. And again, the only “portability problem” here is the fact that they deprecated it in the first place, i.e. a self-inflicted one.\n
\n
Then as a Linux and Unix veteran I gave my subjective opinion by lamenting and criticizing the fact that this depreciation happened, and how changes like this always feel like unnecessary pedantry to me. Yes it’s an expression of frustration, but I am allowed to feel frustrated about it. I don’t need people like you invalidating how I feel about breaking changes in software that I use daily.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703622566 {#5625
date: 2023-12-26 21:29:26.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5618 …}
+nested: Doctrine\ORM\PersistentCollection {#5616 …}
+votes: Doctrine\ORM\PersistentCollection {#5620 …}
+reports: Doctrine\ORM\PersistentCollection {#5631 …}
+favourites: Doctrine\ORM\PersistentCollection {#5633 …}
+notifications: Doctrine\ORM\PersistentCollection {#5635 …}
-id: 254615
-bodyTs: "'allow':145 'alway':128 'beginn':26 'break':163 'chang':125,164 'claim':36 'command':40 'counter':9 'critic':116 'daili':170 'day':56 'deprec':89 'depreci':18,121 'disput':16,34 'distribut':58 'distro':45 'e':32 'egrep':29,39,59 'express':139 'fact':20,52,86,118 'feel':129,147,161 'first':93 'frustrat':141,148 'gave':109 'gnu':53 'grep':31 'hack':46 'happen':122 'i.e':95 'inflict':99 'invalid':158 'lament':114 'like':126,130,156 'link':6 'linux':104 'made':13 'need':154 'never':15,23 'one':100 'opinion':112 'pedantri':132 'peopl':155 'place':94 'point':11 'portabl':81 'problem':82 'recent':67 'recommend':24 'script':76 'self':98 'self-inflict':97 'softwar':166 'sourc':62 'start':68 'still':57 'strawman':3 'subject':111 'tarbal':63 'unix':106 'unnecessari':131 'use':28,169 'veteran':107 'warn':70 'wrapper':75 'year':49 'yes':135"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5580375"
+editedAt: DateTimeImmutable @1708090237 {#5628
date: 2024-02-16 14:30:37.0 +01:00
}
+createdAt: DateTimeImmutable @1703622566 {#5624
date: 2023-12-26 21:29:26.0 +01:00
}
} |
|
Show voter details
|
| 32 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5621
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5585
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5548
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5510
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5425
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4163
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
It is a great book, although a bit outdated. In particular, nowadays `egrep` is not recommended to use. `grep -E` is a more portable synonim.\n
\n
Some notes on you script:\n
\n
1. You don’t need to escape slashes in grep regex. In the sed `s///` command better use another character like `s###` so you also can leave slashes unescaped.\n
2. You usually don’t need to pipe `grep` and `sed`, `sed -n` with regex address and explicit printing command gives the same result as `grep`.\n
3. You could omit leading slash in your `egrep` regex, so you won’t need to remove it later.\n
\n
So I would do the same with\n
\n
```\n
\n
<span style="color:#323232;">tar -tzvf file.tar.gz | sed -En '/.(mp4|mkv)$/{s#^.*/##; s#.[.*##; s#[^a-zA-Z0-9()&-]# #g; s/ +/ /g; p}'\n
</span>\n
```
"""
+lang: "en"
+isAdult: false
+favouriteCount: 14
+score: 0
+lastActive: DateTime @1708114193 {#4164
date: 2024-02-16 21:09:53.0 +01:00
}
+ip: null
+tags: [
"323232"
]
+mentions: [
"@harsh3466@lemmy.world"
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4161 …}
+nested: Doctrine\ORM\PersistentCollection {#4159 …}
+votes: Doctrine\ORM\PersistentCollection {#4157 …}
+reports: Doctrine\ORM\PersistentCollection {#4154 …}
+favourites: Doctrine\ORM\PersistentCollection {#4150 …}
+notifications: Doctrine\ORM\PersistentCollection {#4148 …}
-id: 251438
-bodyTs: "'/g':129 '1':31 '2':60 '3':86 '9':126 'a-za-z0':122 'address':75 'also':55 'although':6 'anoth':49 'better':47 'bit':8 'book':5 'charact':50 'command':46,79 'could':88 'e':20 'egrep':13,94 'en':116 'escap':37 'explicit':77 'file.tar.gz':114 'g':127 'give':80 'great':4 'grep':19,40,68,85 'later':104 'lead':90 'leav':57 'like':51 'mkv':118 'mp4':117 'n':72 'need':35,65,100 'note':27 'nowaday':12 'omit':89 'outdat':9 'p':130 'particular':11 'pipe':67 'portabl':24 'print':78 'recommend':16 'regex':41,74,95 'remov':102 'result':83 'script':30 'sed':44,70,71,115 'slash':38,58,91 'synonim':25 'tar':112 'tzvf':113 'unescap':59 'use':18,48 'usual':62 'won':98 'would':107 'z0':125 'za':124"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6875297"
+editedAt: DateTimeImmutable @1707737027 {#4169
date: 2024-02-12 12:23:47.0 +01:00
}
+createdAt: DateTimeImmutable @1703524389 {#4167
date: 2023-12-25 18:13:09.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> nowadays egrep is not recommended to use. grep -E is a more portable synonim\n
\n
Not directed at you personally, but this is the kind of pointless pedantry from upstream developers that grinds my gears.\n
\n
Like, I’ve used `egrep` for 25 years. I don’t know of a still relevant Unix variant in existence that doesn’t have the `egrep` command. But suddenly now, when any other Unix variant but Linux is all but extinct, and all your shell scripts are probably full of bashisms and Linuxisms anyway, *now* there is somehow a portability problem, and they deem it necessary to print out a warning whenever I dare to run `egrep` instead of `grep -E`? C’mon now … If anything, they have just made it *less* portable by spitting out spurious warnings where there weren’t any before.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 8
+score: 0
+lastActive: DateTime @1703590646 {#5423
date: 2023-12-26 12:37:26.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
]
+children: Doctrine\ORM\PersistentCollection {#5427 …}
+nested: Doctrine\ORM\PersistentCollection {#5429 …}
+votes: Doctrine\ORM\PersistentCollection {#5431 …}
+reports: Doctrine\ORM\PersistentCollection {#5433 …}
+favourites: Doctrine\ORM\PersistentCollection {#5435 …}
+notifications: Doctrine\ORM\PersistentCollection {#5437 …}
-id: 253349
-bodyTs: "'25':41 'anyth':120 'anyway':88 'bashism':85 'c':116 'command':61 'dare':108 'deem':98 'develop':30 'direct':16 'doesn':56 'e':9,115 'egrep':2,39,60,111 'exist':54 'extinct':75 'full':83 'gear':34 'grep':8,114 'grind':32 'instead':112 'kind':24 'know':46 'less':126 'like':35 'linux':71,87 'made':124 'mon':117 'necessari':100 'nowaday':1 'pedantri':27 'person':19 'pointless':26 'portabl':13,94,127 'print':102 'probabl':82 'problem':95 'recommend':5 'relev':50 'run':110 'script':80 'shell':79 'somehow':92 'spit':129 'spurious':131 'still':49 'sudden':63 'synonim':14 'unix':51,68 'upstream':29 'use':7,38 'variant':52,69 've':37 'warn':105,132 'weren':135 'whenev':106 'year':42"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5573914"
+editedAt: null
+createdAt: DateTimeImmutable @1703590646 {#5424
date: 2023-12-26 12:37:26.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
GNU grep, the most widespread implementation, does not include `egrep`, `fgrep` and `rgrep` for years. Distributions (not all, but many) provide shell scripts that simply run `grep` with corresponding option for backward compatibility. You can learn this from official documentation.\n
\n
Also, *my* scripts are not full of bashisms, gnuisms, linuxisms and other -isms, I try to keep them portable unless it is really necessary to use some unportable command or syntax.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703613068 {#5508
date: 2023-12-26 18:51:08.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5511 …}
+nested: Doctrine\ORM\PersistentCollection {#5513 …}
+votes: Doctrine\ORM\PersistentCollection {#5515 …}
+reports: Doctrine\ORM\PersistentCollection {#5517 …}
+favourites: Doctrine\ORM\PersistentCollection {#5519 …}
+notifications: Doctrine\ORM\PersistentCollection {#5521 …}
-id: 254226
-bodyTs: "'also':41 'backward':32 'bashism':48 'command':69 'compat':33 'correspond':29 'distribut':16 'document':40 'egrep':10 'fgrep':11 'full':46 'gnu':1 'gnuism':49 'grep':2,27 'implement':6 'includ':9 'ism':53 'keep':57 'learn':36 'linux':50 'mani':20 'necessari':64 'offici':39 'option':30 'portabl':59 'provid':21 'realli':63 'rgrep':13 'run':26 'script':23,43 'shell':22 'simpli':25 'syntax':71 'tri':55 'unless':60 'unport':68 'use':66 'widespread':5 'year':15"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6891772"
+editedAt: null
+createdAt: DateTimeImmutable @1703613068 {#5509
date: 2023-12-26 18:51:08.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> GNU grep, the most widespread implementation, does not include egrep, fgrep and rgrep for years. Distributions (not all, but many) provide shell scripts that simply run grep with corresponding option for backward compatibility. You can learn this from official documentation.\n
\n
It seems you need to read the official documentation yourself. While it’s new information to me that `egrep` is no longer a symlink, as it used to be a couple of years ago, but a shell script wrapper to `grep -E` instead, the egrep command is to this day still provided by upstream GNU grep and is installed by default if you run `./configure; make; make install` from source. So it is not a backward compatibility hack provided by the distribution.\n
\n
You can check for yourself. Download the source from [ftp.gnu.org/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz), unpack and look for `src/egrep.sh` or line 1756 of `src/Makefile`. Apparently the change from symlink to shell script was done in 2014, and the deprecation warning was added only last year.\n
\n
In any case, my larger point is that the depreciation of `egrep` was a pointless and arbitrary decision that does not benefit users, especially not veterans like myself who have become accustomed to its presence. I don’t mind change, but let’s be honest, most people are not in the habit of checking the minutiae of every little command line utility they use, so a change like this violates the principle of least surprise. It’s one thing if things are changed with a good reason and the users do not only suffer the inconvenience of the change but get to reap the benefits of it as well, but so far I haven’t found any justification for it yet, nor can I think of any.\n
\n
So if there is a portability problem with using `egrep` now, it’s a *self-inflicted* portability problem that they caused by deprecating `egrep` in the first place.\n
\n
> Also, my scripts are not full of bashisms, gnuisms, linuxisms and other -isms, I try to keep them portable unless it is really necessary to use some unportable command or syntax.\n
\n
Good for you. Do you want a cookie or something?
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703616235 {#5545
date: 2023-12-26 19:43:55.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5549 …}
+nested: Doctrine\ORM\PersistentCollection {#5551 …}
+votes: Doctrine\ORM\PersistentCollection {#5553 …}
+reports: Doctrine\ORM\PersistentCollection {#5555 …}
+favourites: Doctrine\ORM\PersistentCollection {#5557 …}
+notifications: Doctrine\ORM\PersistentCollection {#5559 …}
-id: 254374
-bodyTs: "'/configure':105 '/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz),':134 '1756':142 '2014':156 'accustom':197 'ad':162 'ago':74 'also':322 'appar':145 'arbitrari':182 'backward':32,116 'bashism':329 'becom':196 'benefit':187,270 'case':168 'caus':314 'chang':147,205,232,248,264 'check':125,219 'command':86,225,350 'compat':33,117 'cooki':360 'correspond':29 'coupl':71 'day':90 'decis':183 'default':101 'deprec':159,316 'depreci':175 'distribut':16,122 'document':40,49 'done':154 'download':128 'e':82 'egrep':10,59,85,177,302,317 'especi':189 'everi':223 'far':277 'fgrep':11 'first':320 'found':281 'ftp.gnu.org':133 'ftp.gnu.org/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz),':132 'full':327 'get':266 'gnu':1,95 'gnuism':330 'good':251,353 'grep':2,27,81,96 'habit':217 'hack':118 'haven':279 'honest':210 'implement':6 'includ':9 'inconveni':261 'inflict':309 'inform':55 'instal':99,108 'instead':83 'ism':334 'justif':283 'keep':338 'larger':170 'last':164 'learn':36 'least':239 'let':207 'like':192,233 'line':141,226 'linux':331 'littl':224 'longer':62 'look':137 'make':106,107 'mani':20 'mind':204 'minutia':221 'necessari':345 'need':44 'new':54 'offici':39,48 'one':243 'option':30 'peopl':212 'place':321 'point':171 'pointless':180 'portabl':298,310,340 'presenc':200 'principl':237 'problem':299,311 'provid':21,92,119 'read':46 'realli':344 'reap':268 'reason':252 'rgrep':13 'run':26,104 'script':23,78,152,324 'seem':42 'self':308 'self-inflict':307 'shell':22,77,151 'simpli':25 'someth':362 'sourc':110,130 'src/egrep.sh':139 'src/makefile':144 'still':91 'suffer':259 'surpris':240 'symlink':64,149 'syntax':352 'thing':244,246 'think':290 'tri':336 'unless':341 'unpack':135 'unport':349 'upstream':94 'use':67,229,301,347 'user':188,255 'util':227 'veteran':191 'violat':235 'want':358 'warn':160 'well':274 'widespread':5 'wrapper':79 'year':15,73,165 'yet':286"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5578960"
+editedAt: DateTimeImmutable @1708050644 {#5546
date: 2024-02-16 03:30:44.0 +01:00
}
+createdAt: DateTimeImmutable @1703616235 {#5547
date: 2023-12-26 19:43:55.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> It seems you need to read the official documentation yourself.\n
\n
I did. [Debian man page](https://manpages.debian.org/bookworm/grep/grep.1.en.html), [GNU grep manual](https://www.gnu.org/software/grep/manual/html_node/Usage.html).\n
\n
I’m sorry for your loss, however the egrep deprecation is a fact. Of course you can continue using it as a veteran, but it is not correct to recommend this to beginners.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703620836 {#5583
date: 2023-12-26 21:00:36.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5586 …}
+nested: Doctrine\ORM\PersistentCollection {#5588 …}
+votes: Doctrine\ORM\PersistentCollection {#5590 …}
+reports: Doctrine\ORM\PersistentCollection {#5592 …}
+favourites: Doctrine\ORM\PersistentCollection {#5594 …}
+notifications: Doctrine\ORM\PersistentCollection {#5596 …}
-id: 254537
-bodyTs: "'/bookworm/grep/grep.1.en.html),':18 '/software/grep/manual/html_node/usage.html).':24 'beginn':57 'continu':42 'correct':52 'cours':39 'debian':13 'deprec':34 'document':9 'egrep':33 'fact':37 'gnu':19 'grep':20 'howev':31 'loss':30 'm':26 'man':14 'manpages.debian.org':17 'manpages.debian.org/bookworm/grep/grep.1.en.html),':16 'manual':21 'need':4 'offici':8 'page':15 'read':6 'recommend':54 'seem':2 'sorri':27 'use':43 'veteran':47 'www.gnu.org':23 'www.gnu.org/software/grep/manual/html_node/usage.html).':22"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6893637"
+editedAt: null
+createdAt: DateTimeImmutable @1703620836 {#5584
date: 2023-12-26 21:00:36.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
You are strawmanning, and your links are not countering any point I made. I never disputed the depreciation as fact, and I never recommended that beginners should use `egrep` over `grep -E`\n
\n
I disputed your claims that the `egrep` command has *just* been a distro hack all these years, when in fact GNU to this day still distributes `egrep` through its source tarballs and only very recently started to warn about it through the wrapper script. And again, the only “portability problem” here is the fact that they deprecated it in the first place, i.e. a self-inflicted one.\n
\n
Then as a Linux and Unix veteran I gave my subjective opinion by lamenting and criticizing the fact that this depreciation happened, and how changes like this always feel like unnecessary pedantry to me. Yes it’s an expression of frustration, but I am allowed to feel frustrated about it. I don’t need people like you invalidating how I feel about breaking changes in software that I use daily.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703622566 {#5625
date: 2023-12-26 21:29:26.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5618 …}
+nested: Doctrine\ORM\PersistentCollection {#5616 …}
+votes: Doctrine\ORM\PersistentCollection {#5620 …}
+reports: Doctrine\ORM\PersistentCollection {#5631 …}
+favourites: Doctrine\ORM\PersistentCollection {#5633 …}
+notifications: Doctrine\ORM\PersistentCollection {#5635 …}
-id: 254615
-bodyTs: "'allow':145 'alway':128 'beginn':26 'break':163 'chang':125,164 'claim':36 'command':40 'counter':9 'critic':116 'daili':170 'day':56 'deprec':89 'depreci':18,121 'disput':16,34 'distribut':58 'distro':45 'e':32 'egrep':29,39,59 'express':139 'fact':20,52,86,118 'feel':129,147,161 'first':93 'frustrat':141,148 'gave':109 'gnu':53 'grep':31 'hack':46 'happen':122 'i.e':95 'inflict':99 'invalid':158 'lament':114 'like':126,130,156 'link':6 'linux':104 'made':13 'need':154 'never':15,23 'one':100 'opinion':112 'pedantri':132 'peopl':155 'place':94 'point':11 'portabl':81 'problem':82 'recent':67 'recommend':24 'script':76 'self':98 'self-inflict':97 'softwar':166 'sourc':62 'start':68 'still':57 'strawman':3 'subject':111 'tarbal':63 'unix':106 'unnecessari':131 'use':28,169 'veteran':107 'warn':70 'wrapper':75 'year':49 'yes':135"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5580375"
+editedAt: DateTimeImmutable @1708090237 {#5628
date: 2024-02-16 14:30:37.0 +01:00
}
+createdAt: DateTimeImmutable @1703622566 {#5624
date: 2023-12-26 21:29:26.0 +01:00
}
} |
|
Show voter details
|
| 33 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 34 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5600
+user: Proxies\__CG__\App\Entity\User {#5601 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5548
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5510
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5425
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4163
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
It is a great book, although a bit outdated. In particular, nowadays `egrep` is not recommended to use. `grep -E` is a more portable synonim.\n
\n
Some notes on you script:\n
\n
1. You don’t need to escape slashes in grep regex. In the sed `s///` command better use another character like `s###` so you also can leave slashes unescaped.\n
2. You usually don’t need to pipe `grep` and `sed`, `sed -n` with regex address and explicit printing command gives the same result as `grep`.\n
3. You could omit leading slash in your `egrep` regex, so you won’t need to remove it later.\n
\n
So I would do the same with\n
\n
```\n
\n
<span style="color:#323232;">tar -tzvf file.tar.gz | sed -En '/.(mp4|mkv)$/{s#^.*/##; s#.[.*##; s#[^a-zA-Z0-9()&-]# #g; s/ +/ /g; p}'\n
</span>\n
```
"""
+lang: "en"
+isAdult: false
+favouriteCount: 14
+score: 0
+lastActive: DateTime @1708114193 {#4164
date: 2024-02-16 21:09:53.0 +01:00
}
+ip: null
+tags: [
"323232"
]
+mentions: [
"@harsh3466@lemmy.world"
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4161 …}
+nested: Doctrine\ORM\PersistentCollection {#4159 …}
+votes: Doctrine\ORM\PersistentCollection {#4157 …}
+reports: Doctrine\ORM\PersistentCollection {#4154 …}
+favourites: Doctrine\ORM\PersistentCollection {#4150 …}
+notifications: Doctrine\ORM\PersistentCollection {#4148 …}
-id: 251438
-bodyTs: "'/g':129 '1':31 '2':60 '3':86 '9':126 'a-za-z0':122 'address':75 'also':55 'although':6 'anoth':49 'better':47 'bit':8 'book':5 'charact':50 'command':46,79 'could':88 'e':20 'egrep':13,94 'en':116 'escap':37 'explicit':77 'file.tar.gz':114 'g':127 'give':80 'great':4 'grep':19,40,68,85 'later':104 'lead':90 'leav':57 'like':51 'mkv':118 'mp4':117 'n':72 'need':35,65,100 'note':27 'nowaday':12 'omit':89 'outdat':9 'p':130 'particular':11 'pipe':67 'portabl':24 'print':78 'recommend':16 'regex':41,74,95 'remov':102 'result':83 'script':30 'sed':44,70,71,115 'slash':38,58,91 'synonim':25 'tar':112 'tzvf':113 'unescap':59 'use':18,48 'usual':62 'won':98 'would':107 'z0':125 'za':124"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6875297"
+editedAt: DateTimeImmutable @1707737027 {#4169
date: 2024-02-12 12:23:47.0 +01:00
}
+createdAt: DateTimeImmutable @1703524389 {#4167
date: 2023-12-25 18:13:09.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> nowadays egrep is not recommended to use. grep -E is a more portable synonim\n
\n
Not directed at you personally, but this is the kind of pointless pedantry from upstream developers that grinds my gears.\n
\n
Like, I’ve used `egrep` for 25 years. I don’t know of a still relevant Unix variant in existence that doesn’t have the `egrep` command. But suddenly now, when any other Unix variant but Linux is all but extinct, and all your shell scripts are probably full of bashisms and Linuxisms anyway, *now* there is somehow a portability problem, and they deem it necessary to print out a warning whenever I dare to run `egrep` instead of `grep -E`? C’mon now … If anything, they have just made it *less* portable by spitting out spurious warnings where there weren’t any before.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 8
+score: 0
+lastActive: DateTime @1703590646 {#5423
date: 2023-12-26 12:37:26.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
]
+children: Doctrine\ORM\PersistentCollection {#5427 …}
+nested: Doctrine\ORM\PersistentCollection {#5429 …}
+votes: Doctrine\ORM\PersistentCollection {#5431 …}
+reports: Doctrine\ORM\PersistentCollection {#5433 …}
+favourites: Doctrine\ORM\PersistentCollection {#5435 …}
+notifications: Doctrine\ORM\PersistentCollection {#5437 …}
-id: 253349
-bodyTs: "'25':41 'anyth':120 'anyway':88 'bashism':85 'c':116 'command':61 'dare':108 'deem':98 'develop':30 'direct':16 'doesn':56 'e':9,115 'egrep':2,39,60,111 'exist':54 'extinct':75 'full':83 'gear':34 'grep':8,114 'grind':32 'instead':112 'kind':24 'know':46 'less':126 'like':35 'linux':71,87 'made':124 'mon':117 'necessari':100 'nowaday':1 'pedantri':27 'person':19 'pointless':26 'portabl':13,94,127 'print':102 'probabl':82 'problem':95 'recommend':5 'relev':50 'run':110 'script':80 'shell':79 'somehow':92 'spit':129 'spurious':131 'still':49 'sudden':63 'synonim':14 'unix':51,68 'upstream':29 'use':7,38 'variant':52,69 've':37 'warn':105,132 'weren':135 'whenev':106 'year':42"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5573914"
+editedAt: null
+createdAt: DateTimeImmutable @1703590646 {#5424
date: 2023-12-26 12:37:26.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
GNU grep, the most widespread implementation, does not include `egrep`, `fgrep` and `rgrep` for years. Distributions (not all, but many) provide shell scripts that simply run `grep` with corresponding option for backward compatibility. You can learn this from official documentation.\n
\n
Also, *my* scripts are not full of bashisms, gnuisms, linuxisms and other -isms, I try to keep them portable unless it is really necessary to use some unportable command or syntax.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703613068 {#5508
date: 2023-12-26 18:51:08.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5511 …}
+nested: Doctrine\ORM\PersistentCollection {#5513 …}
+votes: Doctrine\ORM\PersistentCollection {#5515 …}
+reports: Doctrine\ORM\PersistentCollection {#5517 …}
+favourites: Doctrine\ORM\PersistentCollection {#5519 …}
+notifications: Doctrine\ORM\PersistentCollection {#5521 …}
-id: 254226
-bodyTs: "'also':41 'backward':32 'bashism':48 'command':69 'compat':33 'correspond':29 'distribut':16 'document':40 'egrep':10 'fgrep':11 'full':46 'gnu':1 'gnuism':49 'grep':2,27 'implement':6 'includ':9 'ism':53 'keep':57 'learn':36 'linux':50 'mani':20 'necessari':64 'offici':39 'option':30 'portabl':59 'provid':21 'realli':63 'rgrep':13 'run':26 'script':23,43 'shell':22 'simpli':25 'syntax':71 'tri':55 'unless':60 'unport':68 'use':66 'widespread':5 'year':15"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6891772"
+editedAt: null
+createdAt: DateTimeImmutable @1703613068 {#5509
date: 2023-12-26 18:51:08.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> GNU grep, the most widespread implementation, does not include egrep, fgrep and rgrep for years. Distributions (not all, but many) provide shell scripts that simply run grep with corresponding option for backward compatibility. You can learn this from official documentation.\n
\n
It seems you need to read the official documentation yourself. While it’s new information to me that `egrep` is no longer a symlink, as it used to be a couple of years ago, but a shell script wrapper to `grep -E` instead, the egrep command is to this day still provided by upstream GNU grep and is installed by default if you run `./configure; make; make install` from source. So it is not a backward compatibility hack provided by the distribution.\n
\n
You can check for yourself. Download the source from [ftp.gnu.org/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz), unpack and look for `src/egrep.sh` or line 1756 of `src/Makefile`. Apparently the change from symlink to shell script was done in 2014, and the deprecation warning was added only last year.\n
\n
In any case, my larger point is that the depreciation of `egrep` was a pointless and arbitrary decision that does not benefit users, especially not veterans like myself who have become accustomed to its presence. I don’t mind change, but let’s be honest, most people are not in the habit of checking the minutiae of every little command line utility they use, so a change like this violates the principle of least surprise. It’s one thing if things are changed with a good reason and the users do not only suffer the inconvenience of the change but get to reap the benefits of it as well, but so far I haven’t found any justification for it yet, nor can I think of any.\n
\n
So if there is a portability problem with using `egrep` now, it’s a *self-inflicted* portability problem that they caused by deprecating `egrep` in the first place.\n
\n
> Also, my scripts are not full of bashisms, gnuisms, linuxisms and other -isms, I try to keep them portable unless it is really necessary to use some unportable command or syntax.\n
\n
Good for you. Do you want a cookie or something?
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703616235 {#5545
date: 2023-12-26 19:43:55.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5549 …}
+nested: Doctrine\ORM\PersistentCollection {#5551 …}
+votes: Doctrine\ORM\PersistentCollection {#5553 …}
+reports: Doctrine\ORM\PersistentCollection {#5555 …}
+favourites: Doctrine\ORM\PersistentCollection {#5557 …}
+notifications: Doctrine\ORM\PersistentCollection {#5559 …}
-id: 254374
-bodyTs: "'/configure':105 '/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz),':134 '1756':142 '2014':156 'accustom':197 'ad':162 'ago':74 'also':322 'appar':145 'arbitrari':182 'backward':32,116 'bashism':329 'becom':196 'benefit':187,270 'case':168 'caus':314 'chang':147,205,232,248,264 'check':125,219 'command':86,225,350 'compat':33,117 'cooki':360 'correspond':29 'coupl':71 'day':90 'decis':183 'default':101 'deprec':159,316 'depreci':175 'distribut':16,122 'document':40,49 'done':154 'download':128 'e':82 'egrep':10,59,85,177,302,317 'especi':189 'everi':223 'far':277 'fgrep':11 'first':320 'found':281 'ftp.gnu.org':133 'ftp.gnu.org/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz),':132 'full':327 'get':266 'gnu':1,95 'gnuism':330 'good':251,353 'grep':2,27,81,96 'habit':217 'hack':118 'haven':279 'honest':210 'implement':6 'includ':9 'inconveni':261 'inflict':309 'inform':55 'instal':99,108 'instead':83 'ism':334 'justif':283 'keep':338 'larger':170 'last':164 'learn':36 'least':239 'let':207 'like':192,233 'line':141,226 'linux':331 'littl':224 'longer':62 'look':137 'make':106,107 'mani':20 'mind':204 'minutia':221 'necessari':345 'need':44 'new':54 'offici':39,48 'one':243 'option':30 'peopl':212 'place':321 'point':171 'pointless':180 'portabl':298,310,340 'presenc':200 'principl':237 'problem':299,311 'provid':21,92,119 'read':46 'realli':344 'reap':268 'reason':252 'rgrep':13 'run':26,104 'script':23,78,152,324 'seem':42 'self':308 'self-inflict':307 'shell':22,77,151 'simpli':25 'someth':362 'sourc':110,130 'src/egrep.sh':139 'src/makefile':144 'still':91 'suffer':259 'surpris':240 'symlink':64,149 'syntax':352 'thing':244,246 'think':290 'tri':336 'unless':341 'unpack':135 'unport':349 'upstream':94 'use':67,229,301,347 'user':188,255 'util':227 'veteran':191 'violat':235 'want':358 'warn':160 'well':274 'widespread':5 'wrapper':79 'year':15,73,165 'yet':286"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5578960"
+editedAt: DateTimeImmutable @1708050644 {#5546
date: 2024-02-16 03:30:44.0 +01:00
}
+createdAt: DateTimeImmutable @1703616235 {#5547
date: 2023-12-26 19:43:55.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> Good for you. Do you want a cookie or something?\n
\n
I don’t know about that guy but you need a chill-pill dude.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 2
+score: 0
+lastActive: DateTime @1703625042 {#5598
date: 2023-12-26 22:10:42.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5602 …}
+nested: Doctrine\ORM\PersistentCollection {#5604 …}
+votes: Doctrine\ORM\PersistentCollection {#5606 …}
+reports: Doctrine\ORM\PersistentCollection {#5608 …}
+favourites: Doctrine\ORM\PersistentCollection {#5610 …}
+notifications: Doctrine\ORM\PersistentCollection {#5612 …}
-id: 254704
-bodyTs: "'chill':23 'chill-pil':22 'cooki':8 'dude':25 'good':1 'guy':17 'know':14 'need':20 'pill':24 'someth':10 'want':6"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6253780"
+editedAt: null
+createdAt: DateTimeImmutable @1703625042 {#5599
date: 2023-12-26 22:10:42.0 +01:00
}
} |
|
Show voter details
|
| 35 |
DENIED
|
edit
|
App\Entity\EntryComment {#5600
+user: Proxies\__CG__\App\Entity\User {#5601 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5548
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5510
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5425
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4163
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
It is a great book, although a bit outdated. In particular, nowadays `egrep` is not recommended to use. `grep -E` is a more portable synonim.\n
\n
Some notes on you script:\n
\n
1. You don’t need to escape slashes in grep regex. In the sed `s///` command better use another character like `s###` so you also can leave slashes unescaped.\n
2. You usually don’t need to pipe `grep` and `sed`, `sed -n` with regex address and explicit printing command gives the same result as `grep`.\n
3. You could omit leading slash in your `egrep` regex, so you won’t need to remove it later.\n
\n
So I would do the same with\n
\n
```\n
\n
<span style="color:#323232;">tar -tzvf file.tar.gz | sed -En '/.(mp4|mkv)$/{s#^.*/##; s#.[.*##; s#[^a-zA-Z0-9()&-]# #g; s/ +/ /g; p}'\n
</span>\n
```
"""
+lang: "en"
+isAdult: false
+favouriteCount: 14
+score: 0
+lastActive: DateTime @1708114193 {#4164
date: 2024-02-16 21:09:53.0 +01:00
}
+ip: null
+tags: [
"323232"
]
+mentions: [
"@harsh3466@lemmy.world"
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4161 …}
+nested: Doctrine\ORM\PersistentCollection {#4159 …}
+votes: Doctrine\ORM\PersistentCollection {#4157 …}
+reports: Doctrine\ORM\PersistentCollection {#4154 …}
+favourites: Doctrine\ORM\PersistentCollection {#4150 …}
+notifications: Doctrine\ORM\PersistentCollection {#4148 …}
-id: 251438
-bodyTs: "'/g':129 '1':31 '2':60 '3':86 '9':126 'a-za-z0':122 'address':75 'also':55 'although':6 'anoth':49 'better':47 'bit':8 'book':5 'charact':50 'command':46,79 'could':88 'e':20 'egrep':13,94 'en':116 'escap':37 'explicit':77 'file.tar.gz':114 'g':127 'give':80 'great':4 'grep':19,40,68,85 'later':104 'lead':90 'leav':57 'like':51 'mkv':118 'mp4':117 'n':72 'need':35,65,100 'note':27 'nowaday':12 'omit':89 'outdat':9 'p':130 'particular':11 'pipe':67 'portabl':24 'print':78 'recommend':16 'regex':41,74,95 'remov':102 'result':83 'script':30 'sed':44,70,71,115 'slash':38,58,91 'synonim':25 'tar':112 'tzvf':113 'unescap':59 'use':18,48 'usual':62 'won':98 'would':107 'z0':125 'za':124"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6875297"
+editedAt: DateTimeImmutable @1707737027 {#4169
date: 2024-02-12 12:23:47.0 +01:00
}
+createdAt: DateTimeImmutable @1703524389 {#4167
date: 2023-12-25 18:13:09.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> nowadays egrep is not recommended to use. grep -E is a more portable synonim\n
\n
Not directed at you personally, but this is the kind of pointless pedantry from upstream developers that grinds my gears.\n
\n
Like, I’ve used `egrep` for 25 years. I don’t know of a still relevant Unix variant in existence that doesn’t have the `egrep` command. But suddenly now, when any other Unix variant but Linux is all but extinct, and all your shell scripts are probably full of bashisms and Linuxisms anyway, *now* there is somehow a portability problem, and they deem it necessary to print out a warning whenever I dare to run `egrep` instead of `grep -E`? C’mon now … If anything, they have just made it *less* portable by spitting out spurious warnings where there weren’t any before.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 8
+score: 0
+lastActive: DateTime @1703590646 {#5423
date: 2023-12-26 12:37:26.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
]
+children: Doctrine\ORM\PersistentCollection {#5427 …}
+nested: Doctrine\ORM\PersistentCollection {#5429 …}
+votes: Doctrine\ORM\PersistentCollection {#5431 …}
+reports: Doctrine\ORM\PersistentCollection {#5433 …}
+favourites: Doctrine\ORM\PersistentCollection {#5435 …}
+notifications: Doctrine\ORM\PersistentCollection {#5437 …}
-id: 253349
-bodyTs: "'25':41 'anyth':120 'anyway':88 'bashism':85 'c':116 'command':61 'dare':108 'deem':98 'develop':30 'direct':16 'doesn':56 'e':9,115 'egrep':2,39,60,111 'exist':54 'extinct':75 'full':83 'gear':34 'grep':8,114 'grind':32 'instead':112 'kind':24 'know':46 'less':126 'like':35 'linux':71,87 'made':124 'mon':117 'necessari':100 'nowaday':1 'pedantri':27 'person':19 'pointless':26 'portabl':13,94,127 'print':102 'probabl':82 'problem':95 'recommend':5 'relev':50 'run':110 'script':80 'shell':79 'somehow':92 'spit':129 'spurious':131 'still':49 'sudden':63 'synonim':14 'unix':51,68 'upstream':29 'use':7,38 'variant':52,69 've':37 'warn':105,132 'weren':135 'whenev':106 'year':42"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5573914"
+editedAt: null
+createdAt: DateTimeImmutable @1703590646 {#5424
date: 2023-12-26 12:37:26.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
GNU grep, the most widespread implementation, does not include `egrep`, `fgrep` and `rgrep` for years. Distributions (not all, but many) provide shell scripts that simply run `grep` with corresponding option for backward compatibility. You can learn this from official documentation.\n
\n
Also, *my* scripts are not full of bashisms, gnuisms, linuxisms and other -isms, I try to keep them portable unless it is really necessary to use some unportable command or syntax.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703613068 {#5508
date: 2023-12-26 18:51:08.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5511 …}
+nested: Doctrine\ORM\PersistentCollection {#5513 …}
+votes: Doctrine\ORM\PersistentCollection {#5515 …}
+reports: Doctrine\ORM\PersistentCollection {#5517 …}
+favourites: Doctrine\ORM\PersistentCollection {#5519 …}
+notifications: Doctrine\ORM\PersistentCollection {#5521 …}
-id: 254226
-bodyTs: "'also':41 'backward':32 'bashism':48 'command':69 'compat':33 'correspond':29 'distribut':16 'document':40 'egrep':10 'fgrep':11 'full':46 'gnu':1 'gnuism':49 'grep':2,27 'implement':6 'includ':9 'ism':53 'keep':57 'learn':36 'linux':50 'mani':20 'necessari':64 'offici':39 'option':30 'portabl':59 'provid':21 'realli':63 'rgrep':13 'run':26 'script':23,43 'shell':22 'simpli':25 'syntax':71 'tri':55 'unless':60 'unport':68 'use':66 'widespread':5 'year':15"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6891772"
+editedAt: null
+createdAt: DateTimeImmutable @1703613068 {#5509
date: 2023-12-26 18:51:08.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> GNU grep, the most widespread implementation, does not include egrep, fgrep and rgrep for years. Distributions (not all, but many) provide shell scripts that simply run grep with corresponding option for backward compatibility. You can learn this from official documentation.\n
\n
It seems you need to read the official documentation yourself. While it’s new information to me that `egrep` is no longer a symlink, as it used to be a couple of years ago, but a shell script wrapper to `grep -E` instead, the egrep command is to this day still provided by upstream GNU grep and is installed by default if you run `./configure; make; make install` from source. So it is not a backward compatibility hack provided by the distribution.\n
\n
You can check for yourself. Download the source from [ftp.gnu.org/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz), unpack and look for `src/egrep.sh` or line 1756 of `src/Makefile`. Apparently the change from symlink to shell script was done in 2014, and the deprecation warning was added only last year.\n
\n
In any case, my larger point is that the depreciation of `egrep` was a pointless and arbitrary decision that does not benefit users, especially not veterans like myself who have become accustomed to its presence. I don’t mind change, but let’s be honest, most people are not in the habit of checking the minutiae of every little command line utility they use, so a change like this violates the principle of least surprise. It’s one thing if things are changed with a good reason and the users do not only suffer the inconvenience of the change but get to reap the benefits of it as well, but so far I haven’t found any justification for it yet, nor can I think of any.\n
\n
So if there is a portability problem with using `egrep` now, it’s a *self-inflicted* portability problem that they caused by deprecating `egrep` in the first place.\n
\n
> Also, my scripts are not full of bashisms, gnuisms, linuxisms and other -isms, I try to keep them portable unless it is really necessary to use some unportable command or syntax.\n
\n
Good for you. Do you want a cookie or something?
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703616235 {#5545
date: 2023-12-26 19:43:55.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5549 …}
+nested: Doctrine\ORM\PersistentCollection {#5551 …}
+votes: Doctrine\ORM\PersistentCollection {#5553 …}
+reports: Doctrine\ORM\PersistentCollection {#5555 …}
+favourites: Doctrine\ORM\PersistentCollection {#5557 …}
+notifications: Doctrine\ORM\PersistentCollection {#5559 …}
-id: 254374
-bodyTs: "'/configure':105 '/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz),':134 '1756':142 '2014':156 'accustom':197 'ad':162 'ago':74 'also':322 'appar':145 'arbitrari':182 'backward':32,116 'bashism':329 'becom':196 'benefit':187,270 'case':168 'caus':314 'chang':147,205,232,248,264 'check':125,219 'command':86,225,350 'compat':33,117 'cooki':360 'correspond':29 'coupl':71 'day':90 'decis':183 'default':101 'deprec':159,316 'depreci':175 'distribut':16,122 'document':40,49 'done':154 'download':128 'e':82 'egrep':10,59,85,177,302,317 'especi':189 'everi':223 'far':277 'fgrep':11 'first':320 'found':281 'ftp.gnu.org':133 'ftp.gnu.org/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz),':132 'full':327 'get':266 'gnu':1,95 'gnuism':330 'good':251,353 'grep':2,27,81,96 'habit':217 'hack':118 'haven':279 'honest':210 'implement':6 'includ':9 'inconveni':261 'inflict':309 'inform':55 'instal':99,108 'instead':83 'ism':334 'justif':283 'keep':338 'larger':170 'last':164 'learn':36 'least':239 'let':207 'like':192,233 'line':141,226 'linux':331 'littl':224 'longer':62 'look':137 'make':106,107 'mani':20 'mind':204 'minutia':221 'necessari':345 'need':44 'new':54 'offici':39,48 'one':243 'option':30 'peopl':212 'place':321 'point':171 'pointless':180 'portabl':298,310,340 'presenc':200 'principl':237 'problem':299,311 'provid':21,92,119 'read':46 'realli':344 'reap':268 'reason':252 'rgrep':13 'run':26,104 'script':23,78,152,324 'seem':42 'self':308 'self-inflict':307 'shell':22,77,151 'simpli':25 'someth':362 'sourc':110,130 'src/egrep.sh':139 'src/makefile':144 'still':91 'suffer':259 'surpris':240 'symlink':64,149 'syntax':352 'thing':244,246 'think':290 'tri':336 'unless':341 'unpack':135 'unport':349 'upstream':94 'use':67,229,301,347 'user':188,255 'util':227 'veteran':191 'violat':235 'want':358 'warn':160 'well':274 'widespread':5 'wrapper':79 'year':15,73,165 'yet':286"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5578960"
+editedAt: DateTimeImmutable @1708050644 {#5546
date: 2024-02-16 03:30:44.0 +01:00
}
+createdAt: DateTimeImmutable @1703616235 {#5547
date: 2023-12-26 19:43:55.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> Good for you. Do you want a cookie or something?\n
\n
I don’t know about that guy but you need a chill-pill dude.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 2
+score: 0
+lastActive: DateTime @1703625042 {#5598
date: 2023-12-26 22:10:42.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5602 …}
+nested: Doctrine\ORM\PersistentCollection {#5604 …}
+votes: Doctrine\ORM\PersistentCollection {#5606 …}
+reports: Doctrine\ORM\PersistentCollection {#5608 …}
+favourites: Doctrine\ORM\PersistentCollection {#5610 …}
+notifications: Doctrine\ORM\PersistentCollection {#5612 …}
-id: 254704
-bodyTs: "'chill':23 'chill-pil':22 'cooki':8 'dude':25 'good':1 'guy':17 'know':14 'need':20 'pill':24 'someth':10 'want':6"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6253780"
+editedAt: null
+createdAt: DateTimeImmutable @1703625042 {#5599
date: 2023-12-26 22:10:42.0 +01:00
}
} |
|
Show voter details
|
| 36 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5600
+user: Proxies\__CG__\App\Entity\User {#5601 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5548
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5510
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5425
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4163
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
It is a great book, although a bit outdated. In particular, nowadays `egrep` is not recommended to use. `grep -E` is a more portable synonim.\n
\n
Some notes on you script:\n
\n
1. You don’t need to escape slashes in grep regex. In the sed `s///` command better use another character like `s###` so you also can leave slashes unescaped.\n
2. You usually don’t need to pipe `grep` and `sed`, `sed -n` with regex address and explicit printing command gives the same result as `grep`.\n
3. You could omit leading slash in your `egrep` regex, so you won’t need to remove it later.\n
\n
So I would do the same with\n
\n
```\n
\n
<span style="color:#323232;">tar -tzvf file.tar.gz | sed -En '/.(mp4|mkv)$/{s#^.*/##; s#.[.*##; s#[^a-zA-Z0-9()&-]# #g; s/ +/ /g; p}'\n
</span>\n
```
"""
+lang: "en"
+isAdult: false
+favouriteCount: 14
+score: 0
+lastActive: DateTime @1708114193 {#4164
date: 2024-02-16 21:09:53.0 +01:00
}
+ip: null
+tags: [
"323232"
]
+mentions: [
"@harsh3466@lemmy.world"
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4161 …}
+nested: Doctrine\ORM\PersistentCollection {#4159 …}
+votes: Doctrine\ORM\PersistentCollection {#4157 …}
+reports: Doctrine\ORM\PersistentCollection {#4154 …}
+favourites: Doctrine\ORM\PersistentCollection {#4150 …}
+notifications: Doctrine\ORM\PersistentCollection {#4148 …}
-id: 251438
-bodyTs: "'/g':129 '1':31 '2':60 '3':86 '9':126 'a-za-z0':122 'address':75 'also':55 'although':6 'anoth':49 'better':47 'bit':8 'book':5 'charact':50 'command':46,79 'could':88 'e':20 'egrep':13,94 'en':116 'escap':37 'explicit':77 'file.tar.gz':114 'g':127 'give':80 'great':4 'grep':19,40,68,85 'later':104 'lead':90 'leav':57 'like':51 'mkv':118 'mp4':117 'n':72 'need':35,65,100 'note':27 'nowaday':12 'omit':89 'outdat':9 'p':130 'particular':11 'pipe':67 'portabl':24 'print':78 'recommend':16 'regex':41,74,95 'remov':102 'result':83 'script':30 'sed':44,70,71,115 'slash':38,58,91 'synonim':25 'tar':112 'tzvf':113 'unescap':59 'use':18,48 'usual':62 'won':98 'would':107 'z0':125 'za':124"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6875297"
+editedAt: DateTimeImmutable @1707737027 {#4169
date: 2024-02-12 12:23:47.0 +01:00
}
+createdAt: DateTimeImmutable @1703524389 {#4167
date: 2023-12-25 18:13:09.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> nowadays egrep is not recommended to use. grep -E is a more portable synonim\n
\n
Not directed at you personally, but this is the kind of pointless pedantry from upstream developers that grinds my gears.\n
\n
Like, I’ve used `egrep` for 25 years. I don’t know of a still relevant Unix variant in existence that doesn’t have the `egrep` command. But suddenly now, when any other Unix variant but Linux is all but extinct, and all your shell scripts are probably full of bashisms and Linuxisms anyway, *now* there is somehow a portability problem, and they deem it necessary to print out a warning whenever I dare to run `egrep` instead of `grep -E`? C’mon now … If anything, they have just made it *less* portable by spitting out spurious warnings where there weren’t any before.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 8
+score: 0
+lastActive: DateTime @1703590646 {#5423
date: 2023-12-26 12:37:26.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
]
+children: Doctrine\ORM\PersistentCollection {#5427 …}
+nested: Doctrine\ORM\PersistentCollection {#5429 …}
+votes: Doctrine\ORM\PersistentCollection {#5431 …}
+reports: Doctrine\ORM\PersistentCollection {#5433 …}
+favourites: Doctrine\ORM\PersistentCollection {#5435 …}
+notifications: Doctrine\ORM\PersistentCollection {#5437 …}
-id: 253349
-bodyTs: "'25':41 'anyth':120 'anyway':88 'bashism':85 'c':116 'command':61 'dare':108 'deem':98 'develop':30 'direct':16 'doesn':56 'e':9,115 'egrep':2,39,60,111 'exist':54 'extinct':75 'full':83 'gear':34 'grep':8,114 'grind':32 'instead':112 'kind':24 'know':46 'less':126 'like':35 'linux':71,87 'made':124 'mon':117 'necessari':100 'nowaday':1 'pedantri':27 'person':19 'pointless':26 'portabl':13,94,127 'print':102 'probabl':82 'problem':95 'recommend':5 'relev':50 'run':110 'script':80 'shell':79 'somehow':92 'spit':129 'spurious':131 'still':49 'sudden':63 'synonim':14 'unix':51,68 'upstream':29 'use':7,38 'variant':52,69 've':37 'warn':105,132 'weren':135 'whenev':106 'year':42"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5573914"
+editedAt: null
+createdAt: DateTimeImmutable @1703590646 {#5424
date: 2023-12-26 12:37:26.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
GNU grep, the most widespread implementation, does not include `egrep`, `fgrep` and `rgrep` for years. Distributions (not all, but many) provide shell scripts that simply run `grep` with corresponding option for backward compatibility. You can learn this from official documentation.\n
\n
Also, *my* scripts are not full of bashisms, gnuisms, linuxisms and other -isms, I try to keep them portable unless it is really necessary to use some unportable command or syntax.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703613068 {#5508
date: 2023-12-26 18:51:08.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5511 …}
+nested: Doctrine\ORM\PersistentCollection {#5513 …}
+votes: Doctrine\ORM\PersistentCollection {#5515 …}
+reports: Doctrine\ORM\PersistentCollection {#5517 …}
+favourites: Doctrine\ORM\PersistentCollection {#5519 …}
+notifications: Doctrine\ORM\PersistentCollection {#5521 …}
-id: 254226
-bodyTs: "'also':41 'backward':32 'bashism':48 'command':69 'compat':33 'correspond':29 'distribut':16 'document':40 'egrep':10 'fgrep':11 'full':46 'gnu':1 'gnuism':49 'grep':2,27 'implement':6 'includ':9 'ism':53 'keep':57 'learn':36 'linux':50 'mani':20 'necessari':64 'offici':39 'option':30 'portabl':59 'provid':21 'realli':63 'rgrep':13 'run':26 'script':23,43 'shell':22 'simpli':25 'syntax':71 'tri':55 'unless':60 'unport':68 'use':66 'widespread':5 'year':15"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6891772"
+editedAt: null
+createdAt: DateTimeImmutable @1703613068 {#5509
date: 2023-12-26 18:51:08.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> GNU grep, the most widespread implementation, does not include egrep, fgrep and rgrep for years. Distributions (not all, but many) provide shell scripts that simply run grep with corresponding option for backward compatibility. You can learn this from official documentation.\n
\n
It seems you need to read the official documentation yourself. While it’s new information to me that `egrep` is no longer a symlink, as it used to be a couple of years ago, but a shell script wrapper to `grep -E` instead, the egrep command is to this day still provided by upstream GNU grep and is installed by default if you run `./configure; make; make install` from source. So it is not a backward compatibility hack provided by the distribution.\n
\n
You can check for yourself. Download the source from [ftp.gnu.org/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz), unpack and look for `src/egrep.sh` or line 1756 of `src/Makefile`. Apparently the change from symlink to shell script was done in 2014, and the deprecation warning was added only last year.\n
\n
In any case, my larger point is that the depreciation of `egrep` was a pointless and arbitrary decision that does not benefit users, especially not veterans like myself who have become accustomed to its presence. I don’t mind change, but let’s be honest, most people are not in the habit of checking the minutiae of every little command line utility they use, so a change like this violates the principle of least surprise. It’s one thing if things are changed with a good reason and the users do not only suffer the inconvenience of the change but get to reap the benefits of it as well, but so far I haven’t found any justification for it yet, nor can I think of any.\n
\n
So if there is a portability problem with using `egrep` now, it’s a *self-inflicted* portability problem that they caused by deprecating `egrep` in the first place.\n
\n
> Also, my scripts are not full of bashisms, gnuisms, linuxisms and other -isms, I try to keep them portable unless it is really necessary to use some unportable command or syntax.\n
\n
Good for you. Do you want a cookie or something?
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703616235 {#5545
date: 2023-12-26 19:43:55.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5549 …}
+nested: Doctrine\ORM\PersistentCollection {#5551 …}
+votes: Doctrine\ORM\PersistentCollection {#5553 …}
+reports: Doctrine\ORM\PersistentCollection {#5555 …}
+favourites: Doctrine\ORM\PersistentCollection {#5557 …}
+notifications: Doctrine\ORM\PersistentCollection {#5559 …}
-id: 254374
-bodyTs: "'/configure':105 '/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz),':134 '1756':142 '2014':156 'accustom':197 'ad':162 'ago':74 'also':322 'appar':145 'arbitrari':182 'backward':32,116 'bashism':329 'becom':196 'benefit':187,270 'case':168 'caus':314 'chang':147,205,232,248,264 'check':125,219 'command':86,225,350 'compat':33,117 'cooki':360 'correspond':29 'coupl':71 'day':90 'decis':183 'default':101 'deprec':159,316 'depreci':175 'distribut':16,122 'document':40,49 'done':154 'download':128 'e':82 'egrep':10,59,85,177,302,317 'especi':189 'everi':223 'far':277 'fgrep':11 'first':320 'found':281 'ftp.gnu.org':133 'ftp.gnu.org/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz),':132 'full':327 'get':266 'gnu':1,95 'gnuism':330 'good':251,353 'grep':2,27,81,96 'habit':217 'hack':118 'haven':279 'honest':210 'implement':6 'includ':9 'inconveni':261 'inflict':309 'inform':55 'instal':99,108 'instead':83 'ism':334 'justif':283 'keep':338 'larger':170 'last':164 'learn':36 'least':239 'let':207 'like':192,233 'line':141,226 'linux':331 'littl':224 'longer':62 'look':137 'make':106,107 'mani':20 'mind':204 'minutia':221 'necessari':345 'need':44 'new':54 'offici':39,48 'one':243 'option':30 'peopl':212 'place':321 'point':171 'pointless':180 'portabl':298,310,340 'presenc':200 'principl':237 'problem':299,311 'provid':21,92,119 'read':46 'realli':344 'reap':268 'reason':252 'rgrep':13 'run':26,104 'script':23,78,152,324 'seem':42 'self':308 'self-inflict':307 'shell':22,77,151 'simpli':25 'someth':362 'sourc':110,130 'src/egrep.sh':139 'src/makefile':144 'still':91 'suffer':259 'surpris':240 'symlink':64,149 'syntax':352 'thing':244,246 'think':290 'tri':336 'unless':341 'unpack':135 'unport':349 'upstream':94 'use':67,229,301,347 'user':188,255 'util':227 'veteran':191 'violat':235 'want':358 'warn':160 'well':274 'widespread':5 'wrapper':79 'year':15,73,165 'yet':286"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5578960"
+editedAt: DateTimeImmutable @1708050644 {#5546
date: 2024-02-16 03:30:44.0 +01:00
}
+createdAt: DateTimeImmutable @1703616235 {#5547
date: 2023-12-26 19:43:55.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> Good for you. Do you want a cookie or something?\n
\n
I don’t know about that guy but you need a chill-pill dude.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 2
+score: 0
+lastActive: DateTime @1703625042 {#5598
date: 2023-12-26 22:10:42.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5602 …}
+nested: Doctrine\ORM\PersistentCollection {#5604 …}
+votes: Doctrine\ORM\PersistentCollection {#5606 …}
+reports: Doctrine\ORM\PersistentCollection {#5608 …}
+favourites: Doctrine\ORM\PersistentCollection {#5610 …}
+notifications: Doctrine\ORM\PersistentCollection {#5612 …}
-id: 254704
-bodyTs: "'chill':23 'chill-pil':22 'cooki':8 'dude':25 'good':1 'guy':17 'know':14 'need':20 'pill':24 'someth':10 'want':6"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6253780"
+editedAt: null
+createdAt: DateTimeImmutable @1703625042 {#5599
date: 2023-12-26 22:10:42.0 +01:00
}
} |
|
Show voter details
|
| 37 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 38 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5640
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5600
+user: Proxies\__CG__\App\Entity\User {#5601 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5548
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5510
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5425
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4163
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
It is a great book, although a bit outdated. In particular, nowadays `egrep` is not recommended to use. `grep -E` is a more portable synonim.\n
\n
Some notes on you script:\n
\n
1. You don’t need to escape slashes in grep regex. In the sed `s///` command better use another character like `s###` so you also can leave slashes unescaped.\n
2. You usually don’t need to pipe `grep` and `sed`, `sed -n` with regex address and explicit printing command gives the same result as `grep`.\n
3. You could omit leading slash in your `egrep` regex, so you won’t need to remove it later.\n
\n
So I would do the same with\n
\n
```\n
\n
<span style="color:#323232;">tar -tzvf file.tar.gz | sed -En '/.(mp4|mkv)$/{s#^.*/##; s#.[.*##; s#[^a-zA-Z0-9()&-]# #g; s/ +/ /g; p}'\n
</span>\n
```
"""
+lang: "en"
+isAdult: false
+favouriteCount: 14
+score: 0
+lastActive: DateTime @1708114193 {#4164
date: 2024-02-16 21:09:53.0 +01:00
}
+ip: null
+tags: [
"323232"
]
+mentions: [
"@harsh3466@lemmy.world"
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4161 …}
+nested: Doctrine\ORM\PersistentCollection {#4159 …}
+votes: Doctrine\ORM\PersistentCollection {#4157 …}
+reports: Doctrine\ORM\PersistentCollection {#4154 …}
+favourites: Doctrine\ORM\PersistentCollection {#4150 …}
+notifications: Doctrine\ORM\PersistentCollection {#4148 …}
-id: 251438
-bodyTs: "'/g':129 '1':31 '2':60 '3':86 '9':126 'a-za-z0':122 'address':75 'also':55 'although':6 'anoth':49 'better':47 'bit':8 'book':5 'charact':50 'command':46,79 'could':88 'e':20 'egrep':13,94 'en':116 'escap':37 'explicit':77 'file.tar.gz':114 'g':127 'give':80 'great':4 'grep':19,40,68,85 'later':104 'lead':90 'leav':57 'like':51 'mkv':118 'mp4':117 'n':72 'need':35,65,100 'note':27 'nowaday':12 'omit':89 'outdat':9 'p':130 'particular':11 'pipe':67 'portabl':24 'print':78 'recommend':16 'regex':41,74,95 'remov':102 'result':83 'script':30 'sed':44,70,71,115 'slash':38,58,91 'synonim':25 'tar':112 'tzvf':113 'unescap':59 'use':18,48 'usual':62 'won':98 'would':107 'z0':125 'za':124"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6875297"
+editedAt: DateTimeImmutable @1707737027 {#4169
date: 2024-02-12 12:23:47.0 +01:00
}
+createdAt: DateTimeImmutable @1703524389 {#4167
date: 2023-12-25 18:13:09.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> nowadays egrep is not recommended to use. grep -E is a more portable synonim\n
\n
Not directed at you personally, but this is the kind of pointless pedantry from upstream developers that grinds my gears.\n
\n
Like, I’ve used `egrep` for 25 years. I don’t know of a still relevant Unix variant in existence that doesn’t have the `egrep` command. But suddenly now, when any other Unix variant but Linux is all but extinct, and all your shell scripts are probably full of bashisms and Linuxisms anyway, *now* there is somehow a portability problem, and they deem it necessary to print out a warning whenever I dare to run `egrep` instead of `grep -E`? C’mon now … If anything, they have just made it *less* portable by spitting out spurious warnings where there weren’t any before.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 8
+score: 0
+lastActive: DateTime @1703590646 {#5423
date: 2023-12-26 12:37:26.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
]
+children: Doctrine\ORM\PersistentCollection {#5427 …}
+nested: Doctrine\ORM\PersistentCollection {#5429 …}
+votes: Doctrine\ORM\PersistentCollection {#5431 …}
+reports: Doctrine\ORM\PersistentCollection {#5433 …}
+favourites: Doctrine\ORM\PersistentCollection {#5435 …}
+notifications: Doctrine\ORM\PersistentCollection {#5437 …}
-id: 253349
-bodyTs: "'25':41 'anyth':120 'anyway':88 'bashism':85 'c':116 'command':61 'dare':108 'deem':98 'develop':30 'direct':16 'doesn':56 'e':9,115 'egrep':2,39,60,111 'exist':54 'extinct':75 'full':83 'gear':34 'grep':8,114 'grind':32 'instead':112 'kind':24 'know':46 'less':126 'like':35 'linux':71,87 'made':124 'mon':117 'necessari':100 'nowaday':1 'pedantri':27 'person':19 'pointless':26 'portabl':13,94,127 'print':102 'probabl':82 'problem':95 'recommend':5 'relev':50 'run':110 'script':80 'shell':79 'somehow':92 'spit':129 'spurious':131 'still':49 'sudden':63 'synonim':14 'unix':51,68 'upstream':29 'use':7,38 'variant':52,69 've':37 'warn':105,132 'weren':135 'whenev':106 'year':42"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5573914"
+editedAt: null
+createdAt: DateTimeImmutable @1703590646 {#5424
date: 2023-12-26 12:37:26.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
GNU grep, the most widespread implementation, does not include `egrep`, `fgrep` and `rgrep` for years. Distributions (not all, but many) provide shell scripts that simply run `grep` with corresponding option for backward compatibility. You can learn this from official documentation.\n
\n
Also, *my* scripts are not full of bashisms, gnuisms, linuxisms and other -isms, I try to keep them portable unless it is really necessary to use some unportable command or syntax.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703613068 {#5508
date: 2023-12-26 18:51:08.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5511 …}
+nested: Doctrine\ORM\PersistentCollection {#5513 …}
+votes: Doctrine\ORM\PersistentCollection {#5515 …}
+reports: Doctrine\ORM\PersistentCollection {#5517 …}
+favourites: Doctrine\ORM\PersistentCollection {#5519 …}
+notifications: Doctrine\ORM\PersistentCollection {#5521 …}
-id: 254226
-bodyTs: "'also':41 'backward':32 'bashism':48 'command':69 'compat':33 'correspond':29 'distribut':16 'document':40 'egrep':10 'fgrep':11 'full':46 'gnu':1 'gnuism':49 'grep':2,27 'implement':6 'includ':9 'ism':53 'keep':57 'learn':36 'linux':50 'mani':20 'necessari':64 'offici':39 'option':30 'portabl':59 'provid':21 'realli':63 'rgrep':13 'run':26 'script':23,43 'shell':22 'simpli':25 'syntax':71 'tri':55 'unless':60 'unport':68 'use':66 'widespread':5 'year':15"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6891772"
+editedAt: null
+createdAt: DateTimeImmutable @1703613068 {#5509
date: 2023-12-26 18:51:08.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> GNU grep, the most widespread implementation, does not include egrep, fgrep and rgrep for years. Distributions (not all, but many) provide shell scripts that simply run grep with corresponding option for backward compatibility. You can learn this from official documentation.\n
\n
It seems you need to read the official documentation yourself. While it’s new information to me that `egrep` is no longer a symlink, as it used to be a couple of years ago, but a shell script wrapper to `grep -E` instead, the egrep command is to this day still provided by upstream GNU grep and is installed by default if you run `./configure; make; make install` from source. So it is not a backward compatibility hack provided by the distribution.\n
\n
You can check for yourself. Download the source from [ftp.gnu.org/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz), unpack and look for `src/egrep.sh` or line 1756 of `src/Makefile`. Apparently the change from symlink to shell script was done in 2014, and the deprecation warning was added only last year.\n
\n
In any case, my larger point is that the depreciation of `egrep` was a pointless and arbitrary decision that does not benefit users, especially not veterans like myself who have become accustomed to its presence. I don’t mind change, but let’s be honest, most people are not in the habit of checking the minutiae of every little command line utility they use, so a change like this violates the principle of least surprise. It’s one thing if things are changed with a good reason and the users do not only suffer the inconvenience of the change but get to reap the benefits of it as well, but so far I haven’t found any justification for it yet, nor can I think of any.\n
\n
So if there is a portability problem with using `egrep` now, it’s a *self-inflicted* portability problem that they caused by deprecating `egrep` in the first place.\n
\n
> Also, my scripts are not full of bashisms, gnuisms, linuxisms and other -isms, I try to keep them portable unless it is really necessary to use some unportable command or syntax.\n
\n
Good for you. Do you want a cookie or something?
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703616235 {#5545
date: 2023-12-26 19:43:55.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5549 …}
+nested: Doctrine\ORM\PersistentCollection {#5551 …}
+votes: Doctrine\ORM\PersistentCollection {#5553 …}
+reports: Doctrine\ORM\PersistentCollection {#5555 …}
+favourites: Doctrine\ORM\PersistentCollection {#5557 …}
+notifications: Doctrine\ORM\PersistentCollection {#5559 …}
-id: 254374
-bodyTs: "'/configure':105 '/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz),':134 '1756':142 '2014':156 'accustom':197 'ad':162 'ago':74 'also':322 'appar':145 'arbitrari':182 'backward':32,116 'bashism':329 'becom':196 'benefit':187,270 'case':168 'caus':314 'chang':147,205,232,248,264 'check':125,219 'command':86,225,350 'compat':33,117 'cooki':360 'correspond':29 'coupl':71 'day':90 'decis':183 'default':101 'deprec':159,316 'depreci':175 'distribut':16,122 'document':40,49 'done':154 'download':128 'e':82 'egrep':10,59,85,177,302,317 'especi':189 'everi':223 'far':277 'fgrep':11 'first':320 'found':281 'ftp.gnu.org':133 'ftp.gnu.org/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz),':132 'full':327 'get':266 'gnu':1,95 'gnuism':330 'good':251,353 'grep':2,27,81,96 'habit':217 'hack':118 'haven':279 'honest':210 'implement':6 'includ':9 'inconveni':261 'inflict':309 'inform':55 'instal':99,108 'instead':83 'ism':334 'justif':283 'keep':338 'larger':170 'last':164 'learn':36 'least':239 'let':207 'like':192,233 'line':141,226 'linux':331 'littl':224 'longer':62 'look':137 'make':106,107 'mani':20 'mind':204 'minutia':221 'necessari':345 'need':44 'new':54 'offici':39,48 'one':243 'option':30 'peopl':212 'place':321 'point':171 'pointless':180 'portabl':298,310,340 'presenc':200 'principl':237 'problem':299,311 'provid':21,92,119 'read':46 'realli':344 'reap':268 'reason':252 'rgrep':13 'run':26,104 'script':23,78,152,324 'seem':42 'self':308 'self-inflict':307 'shell':22,77,151 'simpli':25 'someth':362 'sourc':110,130 'src/egrep.sh':139 'src/makefile':144 'still':91 'suffer':259 'surpris':240 'symlink':64,149 'syntax':352 'thing':244,246 'think':290 'tri':336 'unless':341 'unpack':135 'unport':349 'upstream':94 'use':67,229,301,347 'user':188,255 'util':227 'veteran':191 'violat':235 'want':358 'warn':160 'well':274 'widespread':5 'wrapper':79 'year':15,73,165 'yet':286"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5578960"
+editedAt: DateTimeImmutable @1708050644 {#5546
date: 2024-02-16 03:30:44.0 +01:00
}
+createdAt: DateTimeImmutable @1703616235 {#5547
date: 2023-12-26 19:43:55.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> Good for you. Do you want a cookie or something?\n
\n
I don’t know about that guy but you need a chill-pill dude.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 2
+score: 0
+lastActive: DateTime @1703625042 {#5598
date: 2023-12-26 22:10:42.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5602 …}
+nested: Doctrine\ORM\PersistentCollection {#5604 …}
+votes: Doctrine\ORM\PersistentCollection {#5606 …}
+reports: Doctrine\ORM\PersistentCollection {#5608 …}
+favourites: Doctrine\ORM\PersistentCollection {#5610 …}
+notifications: Doctrine\ORM\PersistentCollection {#5612 …}
-id: 254704
-bodyTs: "'chill':23 'chill-pil':22 'cooki':8 'dude':25 'good':1 'guy':17 'know':14 'need':20 'pill':24 'someth':10 'want':6"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6253780"
+editedAt: null
+createdAt: DateTimeImmutable @1703625042 {#5599
date: 2023-12-26 22:10:42.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
Well he wrote it like he wanted to be applauded for it or something.\n
\n
I also find the irony of your comment extremely funny … although that’s probably lost on you.\n
\n
Later, dude.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 0
+score: 0
+lastActive: DateTime @1703626833 {#5637
date: 2023-12-26 22:40:33.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@ReluctantMuskrat@lemmy.world"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@ReluctantMuskrat@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5641 …}
+nested: Doctrine\ORM\PersistentCollection {#5643 …}
+votes: Doctrine\ORM\PersistentCollection {#5645 …}
+reports: Doctrine\ORM\PersistentCollection {#5647 …}
+favourites: Doctrine\ORM\PersistentCollection {#5649 …}
+notifications: Doctrine\ORM\PersistentCollection {#5651 …}
-id: 254774
-bodyTs: "'also':16 'although':25 'applaud':10 'comment':22 'dude':33 'extrem':23 'find':17 'funni':24 'ironi':19 'later':32 'like':5 'lost':29 'probabl':28 'someth':14 'want':7 'well':1 'wrote':3"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5581155"
+editedAt: DateTimeImmutable @1708114340 {#5638
date: 2024-02-16 21:12:20.0 +01:00
}
+createdAt: DateTimeImmutable @1703626833 {#5639
date: 2023-12-26 22:40:33.0 +01:00
}
} |
|
Show voter details
|
| 39 |
DENIED
|
edit
|
App\Entity\EntryComment {#5640
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5600
+user: Proxies\__CG__\App\Entity\User {#5601 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5548
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5510
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5425
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4163
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
It is a great book, although a bit outdated. In particular, nowadays `egrep` is not recommended to use. `grep -E` is a more portable synonim.\n
\n
Some notes on you script:\n
\n
1. You don’t need to escape slashes in grep regex. In the sed `s///` command better use another character like `s###` so you also can leave slashes unescaped.\n
2. You usually don’t need to pipe `grep` and `sed`, `sed -n` with regex address and explicit printing command gives the same result as `grep`.\n
3. You could omit leading slash in your `egrep` regex, so you won’t need to remove it later.\n
\n
So I would do the same with\n
\n
```\n
\n
<span style="color:#323232;">tar -tzvf file.tar.gz | sed -En '/.(mp4|mkv)$/{s#^.*/##; s#.[.*##; s#[^a-zA-Z0-9()&-]# #g; s/ +/ /g; p}'\n
</span>\n
```
"""
+lang: "en"
+isAdult: false
+favouriteCount: 14
+score: 0
+lastActive: DateTime @1708114193 {#4164
date: 2024-02-16 21:09:53.0 +01:00
}
+ip: null
+tags: [
"323232"
]
+mentions: [
"@harsh3466@lemmy.world"
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4161 …}
+nested: Doctrine\ORM\PersistentCollection {#4159 …}
+votes: Doctrine\ORM\PersistentCollection {#4157 …}
+reports: Doctrine\ORM\PersistentCollection {#4154 …}
+favourites: Doctrine\ORM\PersistentCollection {#4150 …}
+notifications: Doctrine\ORM\PersistentCollection {#4148 …}
-id: 251438
-bodyTs: "'/g':129 '1':31 '2':60 '3':86 '9':126 'a-za-z0':122 'address':75 'also':55 'although':6 'anoth':49 'better':47 'bit':8 'book':5 'charact':50 'command':46,79 'could':88 'e':20 'egrep':13,94 'en':116 'escap':37 'explicit':77 'file.tar.gz':114 'g':127 'give':80 'great':4 'grep':19,40,68,85 'later':104 'lead':90 'leav':57 'like':51 'mkv':118 'mp4':117 'n':72 'need':35,65,100 'note':27 'nowaday':12 'omit':89 'outdat':9 'p':130 'particular':11 'pipe':67 'portabl':24 'print':78 'recommend':16 'regex':41,74,95 'remov':102 'result':83 'script':30 'sed':44,70,71,115 'slash':38,58,91 'synonim':25 'tar':112 'tzvf':113 'unescap':59 'use':18,48 'usual':62 'won':98 'would':107 'z0':125 'za':124"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6875297"
+editedAt: DateTimeImmutable @1707737027 {#4169
date: 2024-02-12 12:23:47.0 +01:00
}
+createdAt: DateTimeImmutable @1703524389 {#4167
date: 2023-12-25 18:13:09.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> nowadays egrep is not recommended to use. grep -E is a more portable synonim\n
\n
Not directed at you personally, but this is the kind of pointless pedantry from upstream developers that grinds my gears.\n
\n
Like, I’ve used `egrep` for 25 years. I don’t know of a still relevant Unix variant in existence that doesn’t have the `egrep` command. But suddenly now, when any other Unix variant but Linux is all but extinct, and all your shell scripts are probably full of bashisms and Linuxisms anyway, *now* there is somehow a portability problem, and they deem it necessary to print out a warning whenever I dare to run `egrep` instead of `grep -E`? C’mon now … If anything, they have just made it *less* portable by spitting out spurious warnings where there weren’t any before.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 8
+score: 0
+lastActive: DateTime @1703590646 {#5423
date: 2023-12-26 12:37:26.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
]
+children: Doctrine\ORM\PersistentCollection {#5427 …}
+nested: Doctrine\ORM\PersistentCollection {#5429 …}
+votes: Doctrine\ORM\PersistentCollection {#5431 …}
+reports: Doctrine\ORM\PersistentCollection {#5433 …}
+favourites: Doctrine\ORM\PersistentCollection {#5435 …}
+notifications: Doctrine\ORM\PersistentCollection {#5437 …}
-id: 253349
-bodyTs: "'25':41 'anyth':120 'anyway':88 'bashism':85 'c':116 'command':61 'dare':108 'deem':98 'develop':30 'direct':16 'doesn':56 'e':9,115 'egrep':2,39,60,111 'exist':54 'extinct':75 'full':83 'gear':34 'grep':8,114 'grind':32 'instead':112 'kind':24 'know':46 'less':126 'like':35 'linux':71,87 'made':124 'mon':117 'necessari':100 'nowaday':1 'pedantri':27 'person':19 'pointless':26 'portabl':13,94,127 'print':102 'probabl':82 'problem':95 'recommend':5 'relev':50 'run':110 'script':80 'shell':79 'somehow':92 'spit':129 'spurious':131 'still':49 'sudden':63 'synonim':14 'unix':51,68 'upstream':29 'use':7,38 'variant':52,69 've':37 'warn':105,132 'weren':135 'whenev':106 'year':42"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5573914"
+editedAt: null
+createdAt: DateTimeImmutable @1703590646 {#5424
date: 2023-12-26 12:37:26.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
GNU grep, the most widespread implementation, does not include `egrep`, `fgrep` and `rgrep` for years. Distributions (not all, but many) provide shell scripts that simply run `grep` with corresponding option for backward compatibility. You can learn this from official documentation.\n
\n
Also, *my* scripts are not full of bashisms, gnuisms, linuxisms and other -isms, I try to keep them portable unless it is really necessary to use some unportable command or syntax.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703613068 {#5508
date: 2023-12-26 18:51:08.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5511 …}
+nested: Doctrine\ORM\PersistentCollection {#5513 …}
+votes: Doctrine\ORM\PersistentCollection {#5515 …}
+reports: Doctrine\ORM\PersistentCollection {#5517 …}
+favourites: Doctrine\ORM\PersistentCollection {#5519 …}
+notifications: Doctrine\ORM\PersistentCollection {#5521 …}
-id: 254226
-bodyTs: "'also':41 'backward':32 'bashism':48 'command':69 'compat':33 'correspond':29 'distribut':16 'document':40 'egrep':10 'fgrep':11 'full':46 'gnu':1 'gnuism':49 'grep':2,27 'implement':6 'includ':9 'ism':53 'keep':57 'learn':36 'linux':50 'mani':20 'necessari':64 'offici':39 'option':30 'portabl':59 'provid':21 'realli':63 'rgrep':13 'run':26 'script':23,43 'shell':22 'simpli':25 'syntax':71 'tri':55 'unless':60 'unport':68 'use':66 'widespread':5 'year':15"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6891772"
+editedAt: null
+createdAt: DateTimeImmutable @1703613068 {#5509
date: 2023-12-26 18:51:08.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> GNU grep, the most widespread implementation, does not include egrep, fgrep and rgrep for years. Distributions (not all, but many) provide shell scripts that simply run grep with corresponding option for backward compatibility. You can learn this from official documentation.\n
\n
It seems you need to read the official documentation yourself. While it’s new information to me that `egrep` is no longer a symlink, as it used to be a couple of years ago, but a shell script wrapper to `grep -E` instead, the egrep command is to this day still provided by upstream GNU grep and is installed by default if you run `./configure; make; make install` from source. So it is not a backward compatibility hack provided by the distribution.\n
\n
You can check for yourself. Download the source from [ftp.gnu.org/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz), unpack and look for `src/egrep.sh` or line 1756 of `src/Makefile`. Apparently the change from symlink to shell script was done in 2014, and the deprecation warning was added only last year.\n
\n
In any case, my larger point is that the depreciation of `egrep` was a pointless and arbitrary decision that does not benefit users, especially not veterans like myself who have become accustomed to its presence. I don’t mind change, but let’s be honest, most people are not in the habit of checking the minutiae of every little command line utility they use, so a change like this violates the principle of least surprise. It’s one thing if things are changed with a good reason and the users do not only suffer the inconvenience of the change but get to reap the benefits of it as well, but so far I haven’t found any justification for it yet, nor can I think of any.\n
\n
So if there is a portability problem with using `egrep` now, it’s a *self-inflicted* portability problem that they caused by deprecating `egrep` in the first place.\n
\n
> Also, my scripts are not full of bashisms, gnuisms, linuxisms and other -isms, I try to keep them portable unless it is really necessary to use some unportable command or syntax.\n
\n
Good for you. Do you want a cookie or something?
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703616235 {#5545
date: 2023-12-26 19:43:55.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5549 …}
+nested: Doctrine\ORM\PersistentCollection {#5551 …}
+votes: Doctrine\ORM\PersistentCollection {#5553 …}
+reports: Doctrine\ORM\PersistentCollection {#5555 …}
+favourites: Doctrine\ORM\PersistentCollection {#5557 …}
+notifications: Doctrine\ORM\PersistentCollection {#5559 …}
-id: 254374
-bodyTs: "'/configure':105 '/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz),':134 '1756':142 '2014':156 'accustom':197 'ad':162 'ago':74 'also':322 'appar':145 'arbitrari':182 'backward':32,116 'bashism':329 'becom':196 'benefit':187,270 'case':168 'caus':314 'chang':147,205,232,248,264 'check':125,219 'command':86,225,350 'compat':33,117 'cooki':360 'correspond':29 'coupl':71 'day':90 'decis':183 'default':101 'deprec':159,316 'depreci':175 'distribut':16,122 'document':40,49 'done':154 'download':128 'e':82 'egrep':10,59,85,177,302,317 'especi':189 'everi':223 'far':277 'fgrep':11 'first':320 'found':281 'ftp.gnu.org':133 'ftp.gnu.org/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz),':132 'full':327 'get':266 'gnu':1,95 'gnuism':330 'good':251,353 'grep':2,27,81,96 'habit':217 'hack':118 'haven':279 'honest':210 'implement':6 'includ':9 'inconveni':261 'inflict':309 'inform':55 'instal':99,108 'instead':83 'ism':334 'justif':283 'keep':338 'larger':170 'last':164 'learn':36 'least':239 'let':207 'like':192,233 'line':141,226 'linux':331 'littl':224 'longer':62 'look':137 'make':106,107 'mani':20 'mind':204 'minutia':221 'necessari':345 'need':44 'new':54 'offici':39,48 'one':243 'option':30 'peopl':212 'place':321 'point':171 'pointless':180 'portabl':298,310,340 'presenc':200 'principl':237 'problem':299,311 'provid':21,92,119 'read':46 'realli':344 'reap':268 'reason':252 'rgrep':13 'run':26,104 'script':23,78,152,324 'seem':42 'self':308 'self-inflict':307 'shell':22,77,151 'simpli':25 'someth':362 'sourc':110,130 'src/egrep.sh':139 'src/makefile':144 'still':91 'suffer':259 'surpris':240 'symlink':64,149 'syntax':352 'thing':244,246 'think':290 'tri':336 'unless':341 'unpack':135 'unport':349 'upstream':94 'use':67,229,301,347 'user':188,255 'util':227 'veteran':191 'violat':235 'want':358 'warn':160 'well':274 'widespread':5 'wrapper':79 'year':15,73,165 'yet':286"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5578960"
+editedAt: DateTimeImmutable @1708050644 {#5546
date: 2024-02-16 03:30:44.0 +01:00
}
+createdAt: DateTimeImmutable @1703616235 {#5547
date: 2023-12-26 19:43:55.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> Good for you. Do you want a cookie or something?\n
\n
I don’t know about that guy but you need a chill-pill dude.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 2
+score: 0
+lastActive: DateTime @1703625042 {#5598
date: 2023-12-26 22:10:42.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5602 …}
+nested: Doctrine\ORM\PersistentCollection {#5604 …}
+votes: Doctrine\ORM\PersistentCollection {#5606 …}
+reports: Doctrine\ORM\PersistentCollection {#5608 …}
+favourites: Doctrine\ORM\PersistentCollection {#5610 …}
+notifications: Doctrine\ORM\PersistentCollection {#5612 …}
-id: 254704
-bodyTs: "'chill':23 'chill-pil':22 'cooki':8 'dude':25 'good':1 'guy':17 'know':14 'need':20 'pill':24 'someth':10 'want':6"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6253780"
+editedAt: null
+createdAt: DateTimeImmutable @1703625042 {#5599
date: 2023-12-26 22:10:42.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
Well he wrote it like he wanted to be applauded for it or something.\n
\n
I also find the irony of your comment extremely funny … although that’s probably lost on you.\n
\n
Later, dude.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 0
+score: 0
+lastActive: DateTime @1703626833 {#5637
date: 2023-12-26 22:40:33.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@ReluctantMuskrat@lemmy.world"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@ReluctantMuskrat@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5641 …}
+nested: Doctrine\ORM\PersistentCollection {#5643 …}
+votes: Doctrine\ORM\PersistentCollection {#5645 …}
+reports: Doctrine\ORM\PersistentCollection {#5647 …}
+favourites: Doctrine\ORM\PersistentCollection {#5649 …}
+notifications: Doctrine\ORM\PersistentCollection {#5651 …}
-id: 254774
-bodyTs: "'also':16 'although':25 'applaud':10 'comment':22 'dude':33 'extrem':23 'find':17 'funni':24 'ironi':19 'later':32 'like':5 'lost':29 'probabl':28 'someth':14 'want':7 'well':1 'wrote':3"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5581155"
+editedAt: DateTimeImmutable @1708114340 {#5638
date: 2024-02-16 21:12:20.0 +01:00
}
+createdAt: DateTimeImmutable @1703626833 {#5639
date: 2023-12-26 22:40:33.0 +01:00
}
} |
|
Show voter details
|
| 40 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5640
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5600
+user: Proxies\__CG__\App\Entity\User {#5601 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5548
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5510
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5425
+user: Proxies\__CG__\App\Entity\User {#5426 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4163
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
It is a great book, although a bit outdated. In particular, nowadays `egrep` is not recommended to use. `grep -E` is a more portable synonim.\n
\n
Some notes on you script:\n
\n
1. You don’t need to escape slashes in grep regex. In the sed `s///` command better use another character like `s###` so you also can leave slashes unescaped.\n
2. You usually don’t need to pipe `grep` and `sed`, `sed -n` with regex address and explicit printing command gives the same result as `grep`.\n
3. You could omit leading slash in your `egrep` regex, so you won’t need to remove it later.\n
\n
So I would do the same with\n
\n
```\n
\n
<span style="color:#323232;">tar -tzvf file.tar.gz | sed -En '/.(mp4|mkv)$/{s#^.*/##; s#.[.*##; s#[^a-zA-Z0-9()&-]# #g; s/ +/ /g; p}'\n
</span>\n
```
"""
+lang: "en"
+isAdult: false
+favouriteCount: 14
+score: 0
+lastActive: DateTime @1708114193 {#4164
date: 2024-02-16 21:09:53.0 +01:00
}
+ip: null
+tags: [
"323232"
]
+mentions: [
"@harsh3466@lemmy.world"
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4161 …}
+nested: Doctrine\ORM\PersistentCollection {#4159 …}
+votes: Doctrine\ORM\PersistentCollection {#4157 …}
+reports: Doctrine\ORM\PersistentCollection {#4154 …}
+favourites: Doctrine\ORM\PersistentCollection {#4150 …}
+notifications: Doctrine\ORM\PersistentCollection {#4148 …}
-id: 251438
-bodyTs: "'/g':129 '1':31 '2':60 '3':86 '9':126 'a-za-z0':122 'address':75 'also':55 'although':6 'anoth':49 'better':47 'bit':8 'book':5 'charact':50 'command':46,79 'could':88 'e':20 'egrep':13,94 'en':116 'escap':37 'explicit':77 'file.tar.gz':114 'g':127 'give':80 'great':4 'grep':19,40,68,85 'later':104 'lead':90 'leav':57 'like':51 'mkv':118 'mp4':117 'n':72 'need':35,65,100 'note':27 'nowaday':12 'omit':89 'outdat':9 'p':130 'particular':11 'pipe':67 'portabl':24 'print':78 'recommend':16 'regex':41,74,95 'remov':102 'result':83 'script':30 'sed':44,70,71,115 'slash':38,58,91 'synonim':25 'tar':112 'tzvf':113 'unescap':59 'use':18,48 'usual':62 'won':98 'would':107 'z0':125 'za':124"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6875297"
+editedAt: DateTimeImmutable @1707737027 {#4169
date: 2024-02-12 12:23:47.0 +01:00
}
+createdAt: DateTimeImmutable @1703524389 {#4167
date: 2023-12-25 18:13:09.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> nowadays egrep is not recommended to use. grep -E is a more portable synonim\n
\n
Not directed at you personally, but this is the kind of pointless pedantry from upstream developers that grinds my gears.\n
\n
Like, I’ve used `egrep` for 25 years. I don’t know of a still relevant Unix variant in existence that doesn’t have the `egrep` command. But suddenly now, when any other Unix variant but Linux is all but extinct, and all your shell scripts are probably full of bashisms and Linuxisms anyway, *now* there is somehow a portability problem, and they deem it necessary to print out a warning whenever I dare to run `egrep` instead of `grep -E`? C’mon now … If anything, they have just made it *less* portable by spitting out spurious warnings where there weren’t any before.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 8
+score: 0
+lastActive: DateTime @1703590646 {#5423
date: 2023-12-26 12:37:26.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
]
+children: Doctrine\ORM\PersistentCollection {#5427 …}
+nested: Doctrine\ORM\PersistentCollection {#5429 …}
+votes: Doctrine\ORM\PersistentCollection {#5431 …}
+reports: Doctrine\ORM\PersistentCollection {#5433 …}
+favourites: Doctrine\ORM\PersistentCollection {#5435 …}
+notifications: Doctrine\ORM\PersistentCollection {#5437 …}
-id: 253349
-bodyTs: "'25':41 'anyth':120 'anyway':88 'bashism':85 'c':116 'command':61 'dare':108 'deem':98 'develop':30 'direct':16 'doesn':56 'e':9,115 'egrep':2,39,60,111 'exist':54 'extinct':75 'full':83 'gear':34 'grep':8,114 'grind':32 'instead':112 'kind':24 'know':46 'less':126 'like':35 'linux':71,87 'made':124 'mon':117 'necessari':100 'nowaday':1 'pedantri':27 'person':19 'pointless':26 'portabl':13,94,127 'print':102 'probabl':82 'problem':95 'recommend':5 'relev':50 'run':110 'script':80 'shell':79 'somehow':92 'spit':129 'spurious':131 'still':49 'sudden':63 'synonim':14 'unix':51,68 'upstream':29 'use':7,38 'variant':52,69 've':37 'warn':105,132 'weren':135 'whenev':106 'year':42"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5573914"
+editedAt: null
+createdAt: DateTimeImmutable @1703590646 {#5424
date: 2023-12-26 12:37:26.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
GNU grep, the most widespread implementation, does not include `egrep`, `fgrep` and `rgrep` for years. Distributions (not all, but many) provide shell scripts that simply run `grep` with corresponding option for backward compatibility. You can learn this from official documentation.\n
\n
Also, *my* scripts are not full of bashisms, gnuisms, linuxisms and other -isms, I try to keep them portable unless it is really necessary to use some unportable command or syntax.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703613068 {#5508
date: 2023-12-26 18:51:08.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5511 …}
+nested: Doctrine\ORM\PersistentCollection {#5513 …}
+votes: Doctrine\ORM\PersistentCollection {#5515 …}
+reports: Doctrine\ORM\PersistentCollection {#5517 …}
+favourites: Doctrine\ORM\PersistentCollection {#5519 …}
+notifications: Doctrine\ORM\PersistentCollection {#5521 …}
-id: 254226
-bodyTs: "'also':41 'backward':32 'bashism':48 'command':69 'compat':33 'correspond':29 'distribut':16 'document':40 'egrep':10 'fgrep':11 'full':46 'gnu':1 'gnuism':49 'grep':2,27 'implement':6 'includ':9 'ism':53 'keep':57 'learn':36 'linux':50 'mani':20 'necessari':64 'offici':39 'option':30 'portabl':59 'provid':21 'realli':63 'rgrep':13 'run':26 'script':23,43 'shell':22 'simpli':25 'syntax':71 'tri':55 'unless':60 'unport':68 'use':66 'widespread':5 'year':15"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6891772"
+editedAt: null
+createdAt: DateTimeImmutable @1703613068 {#5509
date: 2023-12-26 18:51:08.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> GNU grep, the most widespread implementation, does not include egrep, fgrep and rgrep for years. Distributions (not all, but many) provide shell scripts that simply run grep with corresponding option for backward compatibility. You can learn this from official documentation.\n
\n
It seems you need to read the official documentation yourself. While it’s new information to me that `egrep` is no longer a symlink, as it used to be a couple of years ago, but a shell script wrapper to `grep -E` instead, the egrep command is to this day still provided by upstream GNU grep and is installed by default if you run `./configure; make; make install` from source. So it is not a backward compatibility hack provided by the distribution.\n
\n
You can check for yourself. Download the source from [ftp.gnu.org/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz), unpack and look for `src/egrep.sh` or line 1756 of `src/Makefile`. Apparently the change from symlink to shell script was done in 2014, and the deprecation warning was added only last year.\n
\n
In any case, my larger point is that the depreciation of `egrep` was a pointless and arbitrary decision that does not benefit users, especially not veterans like myself who have become accustomed to its presence. I don’t mind change, but let’s be honest, most people are not in the habit of checking the minutiae of every little command line utility they use, so a change like this violates the principle of least surprise. It’s one thing if things are changed with a good reason and the users do not only suffer the inconvenience of the change but get to reap the benefits of it as well, but so far I haven’t found any justification for it yet, nor can I think of any.\n
\n
So if there is a portability problem with using `egrep` now, it’s a *self-inflicted* portability problem that they caused by deprecating `egrep` in the first place.\n
\n
> Also, my scripts are not full of bashisms, gnuisms, linuxisms and other -isms, I try to keep them portable unless it is really necessary to use some unportable command or syntax.\n
\n
Good for you. Do you want a cookie or something?
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703616235 {#5545
date: 2023-12-26 19:43:55.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5549 …}
+nested: Doctrine\ORM\PersistentCollection {#5551 …}
+votes: Doctrine\ORM\PersistentCollection {#5553 …}
+reports: Doctrine\ORM\PersistentCollection {#5555 …}
+favourites: Doctrine\ORM\PersistentCollection {#5557 …}
+notifications: Doctrine\ORM\PersistentCollection {#5559 …}
-id: 254374
-bodyTs: "'/configure':105 '/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz),':134 '1756':142 '2014':156 'accustom':197 'ad':162 'ago':74 'also':322 'appar':145 'arbitrari':182 'backward':32,116 'bashism':329 'becom':196 'benefit':187,270 'case':168 'caus':314 'chang':147,205,232,248,264 'check':125,219 'command':86,225,350 'compat':33,117 'cooki':360 'correspond':29 'coupl':71 'day':90 'decis':183 'default':101 'deprec':159,316 'depreci':175 'distribut':16,122 'document':40,49 'done':154 'download':128 'e':82 'egrep':10,59,85,177,302,317 'especi':189 'everi':223 'far':277 'fgrep':11 'first':320 'found':281 'ftp.gnu.org':133 'ftp.gnu.org/gnu/grep/grep-3.11.tar.gz](https://ftp.gnu.org/gnu/grep/grep-3.11.tar.gz),':132 'full':327 'get':266 'gnu':1,95 'gnuism':330 'good':251,353 'grep':2,27,81,96 'habit':217 'hack':118 'haven':279 'honest':210 'implement':6 'includ':9 'inconveni':261 'inflict':309 'inform':55 'instal':99,108 'instead':83 'ism':334 'justif':283 'keep':338 'larger':170 'last':164 'learn':36 'least':239 'let':207 'like':192,233 'line':141,226 'linux':331 'littl':224 'longer':62 'look':137 'make':106,107 'mani':20 'mind':204 'minutia':221 'necessari':345 'need':44 'new':54 'offici':39,48 'one':243 'option':30 'peopl':212 'place':321 'point':171 'pointless':180 'portabl':298,310,340 'presenc':200 'principl':237 'problem':299,311 'provid':21,92,119 'read':46 'realli':344 'reap':268 'reason':252 'rgrep':13 'run':26,104 'script':23,78,152,324 'seem':42 'self':308 'self-inflict':307 'shell':22,77,151 'simpli':25 'someth':362 'sourc':110,130 'src/egrep.sh':139 'src/makefile':144 'still':91 'suffer':259 'surpris':240 'symlink':64,149 'syntax':352 'thing':244,246 'think':290 'tri':336 'unless':341 'unpack':135 'unport':349 'upstream':94 'use':67,229,301,347 'user':188,255 'util':227 'veteran':191 'violat':235 'want':358 'warn':160 'well':274 'widespread':5 'wrapper':79 'year':15,73,165 'yet':286"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5578960"
+editedAt: DateTimeImmutable @1708050644 {#5546
date: 2024-02-16 03:30:44.0 +01:00
}
+createdAt: DateTimeImmutable @1703616235 {#5547
date: 2023-12-26 19:43:55.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
> Good for you. Do you want a cookie or something?\n
\n
I don’t know about that guy but you need a chill-pill dude.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 2
+score: 0
+lastActive: DateTime @1703625042 {#5598
date: 2023-12-26 22:10:42.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
]
+children: Doctrine\ORM\PersistentCollection {#5602 …}
+nested: Doctrine\ORM\PersistentCollection {#5604 …}
+votes: Doctrine\ORM\PersistentCollection {#5606 …}
+reports: Doctrine\ORM\PersistentCollection {#5608 …}
+favourites: Doctrine\ORM\PersistentCollection {#5610 …}
+notifications: Doctrine\ORM\PersistentCollection {#5612 …}
-id: 254704
-bodyTs: "'chill':23 'chill-pil':22 'cooki':8 'dude':25 'good':1 'guy':17 'know':14 'need':20 'pill':24 'someth':10 'want':6"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6253780"
+editedAt: null
+createdAt: DateTimeImmutable @1703625042 {#5599
date: 2023-12-26 22:10:42.0 +01:00
}
}
+root: App\Entity\EntryComment {#4163}
+body: """
Well he wrote it like he wanted to be applauded for it or something.\n
\n
I also find the irony of your comment extremely funny … although that’s probably lost on you.\n
\n
Later, dude.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 0
+score: 0
+lastActive: DateTime @1703626833 {#5637
date: 2023-12-26 22:40:33.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@ReluctantMuskrat@lemmy.world"
"@harsh3466@lemmy.world"
"@bizdelnick@lemmy.ml"
"@SpaceCadet@feddit.nl"
"@ReluctantMuskrat@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5641 …}
+nested: Doctrine\ORM\PersistentCollection {#5643 …}
+votes: Doctrine\ORM\PersistentCollection {#5645 …}
+reports: Doctrine\ORM\PersistentCollection {#5647 …}
+favourites: Doctrine\ORM\PersistentCollection {#5649 …}
+notifications: Doctrine\ORM\PersistentCollection {#5651 …}
-id: 254774
-bodyTs: "'also':16 'although':25 'applaud':10 'comment':22 'dude':33 'extrem':23 'find':17 'funni':24 'ironi':19 'later':32 'like':5 'lost':29 'probabl':28 'someth':14 'want':7 'well':1 'wrote':3"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5581155"
+editedAt: DateTimeImmutable @1708114340 {#5638
date: 2024-02-16 21:12:20.0 +01:00
}
+createdAt: DateTimeImmutable @1703626833 {#5639
date: 2023-12-26 22:40:33.0 +01:00
}
} |
|
Show voter details
|
| 41 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 42 |
DENIED
|
moderate
|
App\Entity\EntryComment {#4244
+user: App\Entity\User {#4257 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "I’ll have to check out this book. Just remember [HTML cannot be parsed with regex](http://stackoverflow.com/questions/1732348/ddg#1732454)"
+lang: "en"
+isAdult: false
+favouriteCount: 6
+score: 0
+lastActive: DateTime @1707880478 {#4239
date: 2024-02-14 04:14:38.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4245 …}
+nested: Doctrine\ORM\PersistentCollection {#4247 …}
+votes: Doctrine\ORM\PersistentCollection {#4249 …}
+reports: Doctrine\ORM\PersistentCollection {#4251 …}
+favourites: Doctrine\ORM\PersistentCollection {#4253 …}
+notifications: Doctrine\ORM\PersistentCollection {#4255 …}
-id: 251161
-bodyTs: "'/questions/1732348/ddg#1732454)':19 'book':8 'cannot':12 'check':5 'html':11 'll':2 'pars':14 'regex':16 'rememb':10 'stackoverflow.com':18 'stackoverflow.com/questions/1732348/ddg#1732454)':17"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6236016"
+editedAt: null
+createdAt: DateTimeImmutable @1703515088 {#4240
date: 2023-12-25 15:38:08.0 +01:00
}
} |
|
Show voter details
|
| 43 |
DENIED
|
edit
|
App\Entity\EntryComment {#4244
+user: App\Entity\User {#4257 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "I’ll have to check out this book. Just remember [HTML cannot be parsed with regex](http://stackoverflow.com/questions/1732348/ddg#1732454)"
+lang: "en"
+isAdult: false
+favouriteCount: 6
+score: 0
+lastActive: DateTime @1707880478 {#4239
date: 2024-02-14 04:14:38.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4245 …}
+nested: Doctrine\ORM\PersistentCollection {#4247 …}
+votes: Doctrine\ORM\PersistentCollection {#4249 …}
+reports: Doctrine\ORM\PersistentCollection {#4251 …}
+favourites: Doctrine\ORM\PersistentCollection {#4253 …}
+notifications: Doctrine\ORM\PersistentCollection {#4255 …}
-id: 251161
-bodyTs: "'/questions/1732348/ddg#1732454)':19 'book':8 'cannot':12 'check':5 'html':11 'll':2 'pars':14 'regex':16 'rememb':10 'stackoverflow.com':18 'stackoverflow.com/questions/1732348/ddg#1732454)':17"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6236016"
+editedAt: null
+createdAt: DateTimeImmutable @1703515088 {#4240
date: 2023-12-25 15:38:08.0 +01:00
}
} |
|
Show voter details
|
| 44 |
DENIED
|
moderate
|
App\Entity\EntryComment {#4244
+user: App\Entity\User {#4257 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "I’ll have to check out this book. Just remember [HTML cannot be parsed with regex](http://stackoverflow.com/questions/1732348/ddg#1732454)"
+lang: "en"
+isAdult: false
+favouriteCount: 6
+score: 0
+lastActive: DateTime @1707880478 {#4239
date: 2024-02-14 04:14:38.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4245 …}
+nested: Doctrine\ORM\PersistentCollection {#4247 …}
+votes: Doctrine\ORM\PersistentCollection {#4249 …}
+reports: Doctrine\ORM\PersistentCollection {#4251 …}
+favourites: Doctrine\ORM\PersistentCollection {#4253 …}
+notifications: Doctrine\ORM\PersistentCollection {#4255 …}
-id: 251161
-bodyTs: "'/questions/1732348/ddg#1732454)':19 'book':8 'cannot':12 'check':5 'html':11 'll':2 'pars':14 'regex':16 'rememb':10 'stackoverflow.com':18 'stackoverflow.com/questions/1732348/ddg#1732454)':17"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6236016"
+editedAt: null
+createdAt: DateTimeImmutable @1703515088 {#4240
date: 2023-12-25 15:38:08.0 +01:00
}
} |
|
Show voter details
|
| 45 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 46 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5394
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4244
+user: App\Entity\User {#4257 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "I’ll have to check out this book. Just remember [HTML cannot be parsed with regex](http://stackoverflow.com/questions/1732348/ddg#1732454)"
+lang: "en"
+isAdult: false
+favouriteCount: 6
+score: 0
+lastActive: DateTime @1707880478 {#4239
date: 2024-02-14 04:14:38.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4245 …}
+nested: Doctrine\ORM\PersistentCollection {#4247 …}
+votes: Doctrine\ORM\PersistentCollection {#4249 …}
+reports: Doctrine\ORM\PersistentCollection {#4251 …}
+favourites: Doctrine\ORM\PersistentCollection {#4253 …}
+notifications: Doctrine\ORM\PersistentCollection {#4255 …}
-id: 251161
-bodyTs: "'/questions/1732348/ddg#1732454)':19 'book':8 'cannot':12 'check':5 'html':11 'll':2 'pars':14 'regex':16 'rememb':10 'stackoverflow.com':18 'stackoverflow.com/questions/1732348/ddg#1732454)':17"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6236016"
+editedAt: null
+createdAt: DateTimeImmutable @1703515088 {#4240
date: 2023-12-25 15:38:08.0 +01:00
}
}
+root: App\Entity\EntryComment {#4244}
+body: "Well, technically it is possible with regex dialect that has lookarounds, but it is overcomplicated. There’s really no reason to do it."
+lang: "en"
+isAdult: false
+favouriteCount: 2
+score: 0
+lastActive: DateTime @1703546777 {#5391
date: 2023-12-26 00:26:17.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@mindlessLump@lemmy.world"
"@harsh3466@lemmy.world"
"@mindlessLump@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5395 …}
+nested: Doctrine\ORM\PersistentCollection {#5397 …}
+votes: Doctrine\ORM\PersistentCollection {#5399 …}
+reports: Doctrine\ORM\PersistentCollection {#5401 …}
+favourites: Doctrine\ORM\PersistentCollection {#5403 …}
+notifications: Doctrine\ORM\PersistentCollection {#5405 …}
-id: 252227
-bodyTs: "'dialect':8 'lookaround':11 'overcompl':15 'possibl':5 'realli':18 'reason':20 'regex':7 'technic':2 'well':1"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6880467"
+editedAt: DateTimeImmutable @1707794243 {#5392
date: 2024-02-13 04:17:23.0 +01:00
}
+createdAt: DateTimeImmutable @1703546777 {#5393
date: 2023-12-26 00:26:17.0 +01:00
}
} |
|
Show voter details
|
| 47 |
DENIED
|
edit
|
App\Entity\EntryComment {#5394
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4244
+user: App\Entity\User {#4257 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "I’ll have to check out this book. Just remember [HTML cannot be parsed with regex](http://stackoverflow.com/questions/1732348/ddg#1732454)"
+lang: "en"
+isAdult: false
+favouriteCount: 6
+score: 0
+lastActive: DateTime @1707880478 {#4239
date: 2024-02-14 04:14:38.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4245 …}
+nested: Doctrine\ORM\PersistentCollection {#4247 …}
+votes: Doctrine\ORM\PersistentCollection {#4249 …}
+reports: Doctrine\ORM\PersistentCollection {#4251 …}
+favourites: Doctrine\ORM\PersistentCollection {#4253 …}
+notifications: Doctrine\ORM\PersistentCollection {#4255 …}
-id: 251161
-bodyTs: "'/questions/1732348/ddg#1732454)':19 'book':8 'cannot':12 'check':5 'html':11 'll':2 'pars':14 'regex':16 'rememb':10 'stackoverflow.com':18 'stackoverflow.com/questions/1732348/ddg#1732454)':17"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6236016"
+editedAt: null
+createdAt: DateTimeImmutable @1703515088 {#4240
date: 2023-12-25 15:38:08.0 +01:00
}
}
+root: App\Entity\EntryComment {#4244}
+body: "Well, technically it is possible with regex dialect that has lookarounds, but it is overcomplicated. There’s really no reason to do it."
+lang: "en"
+isAdult: false
+favouriteCount: 2
+score: 0
+lastActive: DateTime @1703546777 {#5391
date: 2023-12-26 00:26:17.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@mindlessLump@lemmy.world"
"@harsh3466@lemmy.world"
"@mindlessLump@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5395 …}
+nested: Doctrine\ORM\PersistentCollection {#5397 …}
+votes: Doctrine\ORM\PersistentCollection {#5399 …}
+reports: Doctrine\ORM\PersistentCollection {#5401 …}
+favourites: Doctrine\ORM\PersistentCollection {#5403 …}
+notifications: Doctrine\ORM\PersistentCollection {#5405 …}
-id: 252227
-bodyTs: "'dialect':8 'lookaround':11 'overcompl':15 'possibl':5 'realli':18 'reason':20 'regex':7 'technic':2 'well':1"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6880467"
+editedAt: DateTimeImmutable @1707794243 {#5392
date: 2024-02-13 04:17:23.0 +01:00
}
+createdAt: DateTimeImmutable @1703546777 {#5393
date: 2023-12-26 00:26:17.0 +01:00
}
} |
|
Show voter details
|
| 48 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5394
+user: App\Entity\User {#4146 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4244
+user: App\Entity\User {#4257 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "I’ll have to check out this book. Just remember [HTML cannot be parsed with regex](http://stackoverflow.com/questions/1732348/ddg#1732454)"
+lang: "en"
+isAdult: false
+favouriteCount: 6
+score: 0
+lastActive: DateTime @1707880478 {#4239
date: 2024-02-14 04:14:38.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4245 …}
+nested: Doctrine\ORM\PersistentCollection {#4247 …}
+votes: Doctrine\ORM\PersistentCollection {#4249 …}
+reports: Doctrine\ORM\PersistentCollection {#4251 …}
+favourites: Doctrine\ORM\PersistentCollection {#4253 …}
+notifications: Doctrine\ORM\PersistentCollection {#4255 …}
-id: 251161
-bodyTs: "'/questions/1732348/ddg#1732454)':19 'book':8 'cannot':12 'check':5 'html':11 'll':2 'pars':14 'regex':16 'rememb':10 'stackoverflow.com':18 'stackoverflow.com/questions/1732348/ddg#1732454)':17"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6236016"
+editedAt: null
+createdAt: DateTimeImmutable @1703515088 {#4240
date: 2023-12-25 15:38:08.0 +01:00
}
}
+root: App\Entity\EntryComment {#4244}
+body: "Well, technically it is possible with regex dialect that has lookarounds, but it is overcomplicated. There’s really no reason to do it."
+lang: "en"
+isAdult: false
+favouriteCount: 2
+score: 0
+lastActive: DateTime @1703546777 {#5391
date: 2023-12-26 00:26:17.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@mindlessLump@lemmy.world"
"@harsh3466@lemmy.world"
"@mindlessLump@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5395 …}
+nested: Doctrine\ORM\PersistentCollection {#5397 …}
+votes: Doctrine\ORM\PersistentCollection {#5399 …}
+reports: Doctrine\ORM\PersistentCollection {#5401 …}
+favourites: Doctrine\ORM\PersistentCollection {#5403 …}
+notifications: Doctrine\ORM\PersistentCollection {#5405 …}
-id: 252227
-bodyTs: "'dialect':8 'lookaround':11 'overcompl':15 'possibl':5 'realli':18 'reason':20 'regex':7 'technic':2 'well':1"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6880467"
+editedAt: DateTimeImmutable @1707794243 {#5392
date: 2024-02-13 04:17:23.0 +01:00
}
+createdAt: DateTimeImmutable @1703546777 {#5393
date: 2023-12-26 00:26:17.0 +01:00
}
} |
|
Show voter details
|
| 49 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 50 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5409
+user: Proxies\__CG__\App\Entity\User {#5410 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4244
+user: App\Entity\User {#4257 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "I’ll have to check out this book. Just remember [HTML cannot be parsed with regex](http://stackoverflow.com/questions/1732348/ddg#1732454)"
+lang: "en"
+isAdult: false
+favouriteCount: 6
+score: 0
+lastActive: DateTime @1707880478 {#4239
date: 2024-02-14 04:14:38.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4245 …}
+nested: Doctrine\ORM\PersistentCollection {#4247 …}
+votes: Doctrine\ORM\PersistentCollection {#4249 …}
+reports: Doctrine\ORM\PersistentCollection {#4251 …}
+favourites: Doctrine\ORM\PersistentCollection {#4253 …}
+notifications: Doctrine\ORM\PersistentCollection {#4255 …}
-id: 251161
-bodyTs: "'/questions/1732348/ddg#1732454)':19 'book':8 'cannot':12 'check':5 'html':11 'll':2 'pars':14 'regex':16 'rememb':10 'stackoverflow.com':18 'stackoverflow.com/questions/1732348/ddg#1732454)':17"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6236016"
+editedAt: null
+createdAt: DateTimeImmutable @1703515088 {#4240
date: 2023-12-25 15:38:08.0 +01:00
}
}
+root: App\Entity\EntryComment {#4244}
+body: "Thanks for that link."
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703582096 {#5407
date: 2023-12-26 10:14:56.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@mindlessLump@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5411 …}
+nested: Doctrine\ORM\PersistentCollection {#5413 …}
+votes: Doctrine\ORM\PersistentCollection {#5415 …}
+reports: Doctrine\ORM\PersistentCollection {#5417 …}
+favourites: Doctrine\ORM\PersistentCollection {#5419 …}
+notifications: Doctrine\ORM\PersistentCollection {#5421 …}
-id: 253153
-bodyTs: "'link':4 'thank':1"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.ro/comment/1645097"
+editedAt: null
+createdAt: DateTimeImmutable @1703582096 {#5408
date: 2023-12-26 10:14:56.0 +01:00
}
} |
|
Show voter details
|
| 51 |
DENIED
|
edit
|
App\Entity\EntryComment {#5409
+user: Proxies\__CG__\App\Entity\User {#5410 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4244
+user: App\Entity\User {#4257 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "I’ll have to check out this book. Just remember [HTML cannot be parsed with regex](http://stackoverflow.com/questions/1732348/ddg#1732454)"
+lang: "en"
+isAdult: false
+favouriteCount: 6
+score: 0
+lastActive: DateTime @1707880478 {#4239
date: 2024-02-14 04:14:38.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4245 …}
+nested: Doctrine\ORM\PersistentCollection {#4247 …}
+votes: Doctrine\ORM\PersistentCollection {#4249 …}
+reports: Doctrine\ORM\PersistentCollection {#4251 …}
+favourites: Doctrine\ORM\PersistentCollection {#4253 …}
+notifications: Doctrine\ORM\PersistentCollection {#4255 …}
-id: 251161
-bodyTs: "'/questions/1732348/ddg#1732454)':19 'book':8 'cannot':12 'check':5 'html':11 'll':2 'pars':14 'regex':16 'rememb':10 'stackoverflow.com':18 'stackoverflow.com/questions/1732348/ddg#1732454)':17"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6236016"
+editedAt: null
+createdAt: DateTimeImmutable @1703515088 {#4240
date: 2023-12-25 15:38:08.0 +01:00
}
}
+root: App\Entity\EntryComment {#4244}
+body: "Thanks for that link."
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703582096 {#5407
date: 2023-12-26 10:14:56.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@mindlessLump@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5411 …}
+nested: Doctrine\ORM\PersistentCollection {#5413 …}
+votes: Doctrine\ORM\PersistentCollection {#5415 …}
+reports: Doctrine\ORM\PersistentCollection {#5417 …}
+favourites: Doctrine\ORM\PersistentCollection {#5419 …}
+notifications: Doctrine\ORM\PersistentCollection {#5421 …}
-id: 253153
-bodyTs: "'link':4 'thank':1"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.ro/comment/1645097"
+editedAt: null
+createdAt: DateTimeImmutable @1703582096 {#5408
date: 2023-12-26 10:14:56.0 +01:00
}
} |
|
Show voter details
|
| 52 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5409
+user: Proxies\__CG__\App\Entity\User {#5410 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4244
+user: App\Entity\User {#4257 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "I’ll have to check out this book. Just remember [HTML cannot be parsed with regex](http://stackoverflow.com/questions/1732348/ddg#1732454)"
+lang: "en"
+isAdult: false
+favouriteCount: 6
+score: 0
+lastActive: DateTime @1707880478 {#4239
date: 2024-02-14 04:14:38.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4245 …}
+nested: Doctrine\ORM\PersistentCollection {#4247 …}
+votes: Doctrine\ORM\PersistentCollection {#4249 …}
+reports: Doctrine\ORM\PersistentCollection {#4251 …}
+favourites: Doctrine\ORM\PersistentCollection {#4253 …}
+notifications: Doctrine\ORM\PersistentCollection {#4255 …}
-id: 251161
-bodyTs: "'/questions/1732348/ddg#1732454)':19 'book':8 'cannot':12 'check':5 'html':11 'll':2 'pars':14 'regex':16 'rememb':10 'stackoverflow.com':18 'stackoverflow.com/questions/1732348/ddg#1732454)':17"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6236016"
+editedAt: null
+createdAt: DateTimeImmutable @1703515088 {#4240
date: 2023-12-25 15:38:08.0 +01:00
}
}
+root: App\Entity\EntryComment {#4244}
+body: "Thanks for that link."
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703582096 {#5407
date: 2023-12-26 10:14:56.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@mindlessLump@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5411 …}
+nested: Doctrine\ORM\PersistentCollection {#5413 …}
+votes: Doctrine\ORM\PersistentCollection {#5415 …}
+reports: Doctrine\ORM\PersistentCollection {#5417 …}
+favourites: Doctrine\ORM\PersistentCollection {#5419 …}
+notifications: Doctrine\ORM\PersistentCollection {#5421 …}
-id: 253153
-bodyTs: "'link':4 'thank':1"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.ro/comment/1645097"
+editedAt: null
+createdAt: DateTimeImmutable @1703582096 {#5408
date: 2023-12-26 10:14:56.0 +01:00
}
} |
|
Show voter details
|
| 53 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 54 |
DENIED
|
moderate
|
App\Entity\EntryComment {#4317
+user: App\Entity\User {#4330 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "I relearn regex from scratch every time I need to use it."
+lang: "en"
+isAdult: false
+favouriteCount: 63
+score: 0
+lastActive: DateTime @1707749045 {#4312
date: 2024-02-12 15:44:05.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4318 …}
+nested: Doctrine\ORM\PersistentCollection {#4320 …}
+votes: Doctrine\ORM\PersistentCollection {#4322 …}
+reports: Doctrine\ORM\PersistentCollection {#4324 …}
+favourites: Doctrine\ORM\PersistentCollection {#4326 …}
+notifications: Doctrine\ORM\PersistentCollection {#4328 …}
-id: 250300
-bodyTs: "'everi':6 'need':9 'regex':3 'relearn':2 'scratch':5 'time':7 'use':11"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6231621"
+editedAt: null
+createdAt: DateTimeImmutable @1703478179 {#4313
date: 2023-12-25 05:22:59.0 +01:00
}
} |
|
Show voter details
|
| 55 |
DENIED
|
edit
|
App\Entity\EntryComment {#4317
+user: App\Entity\User {#4330 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "I relearn regex from scratch every time I need to use it."
+lang: "en"
+isAdult: false
+favouriteCount: 63
+score: 0
+lastActive: DateTime @1707749045 {#4312
date: 2024-02-12 15:44:05.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4318 …}
+nested: Doctrine\ORM\PersistentCollection {#4320 …}
+votes: Doctrine\ORM\PersistentCollection {#4322 …}
+reports: Doctrine\ORM\PersistentCollection {#4324 …}
+favourites: Doctrine\ORM\PersistentCollection {#4326 …}
+notifications: Doctrine\ORM\PersistentCollection {#4328 …}
-id: 250300
-bodyTs: "'everi':6 'need':9 'regex':3 'relearn':2 'scratch':5 'time':7 'use':11"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6231621"
+editedAt: null
+createdAt: DateTimeImmutable @1703478179 {#4313
date: 2023-12-25 05:22:59.0 +01:00
}
} |
|
Show voter details
|
| 56 |
DENIED
|
moderate
|
App\Entity\EntryComment {#4317
+user: App\Entity\User {#4330 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "I relearn regex from scratch every time I need to use it."
+lang: "en"
+isAdult: false
+favouriteCount: 63
+score: 0
+lastActive: DateTime @1707749045 {#4312
date: 2024-02-12 15:44:05.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4318 …}
+nested: Doctrine\ORM\PersistentCollection {#4320 …}
+votes: Doctrine\ORM\PersistentCollection {#4322 …}
+reports: Doctrine\ORM\PersistentCollection {#4324 …}
+favourites: Doctrine\ORM\PersistentCollection {#4326 …}
+notifications: Doctrine\ORM\PersistentCollection {#4328 …}
-id: 250300
-bodyTs: "'everi':6 'need':9 'regex':3 'relearn':2 'scratch':5 'time':7 'use':11"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6231621"
+editedAt: null
+createdAt: DateTimeImmutable @1703478179 {#4313
date: 2023-12-25 05:22:59.0 +01:00
}
} |
|
Show voter details
|
| 57 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 58 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5377
+user: Proxies\__CG__\App\Entity\User {#5378 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4317
+user: App\Entity\User {#4330 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "I relearn regex from scratch every time I need to use it."
+lang: "en"
+isAdult: false
+favouriteCount: 63
+score: 0
+lastActive: DateTime @1707749045 {#4312
date: 2024-02-12 15:44:05.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4318 …}
+nested: Doctrine\ORM\PersistentCollection {#4320 …}
+votes: Doctrine\ORM\PersistentCollection {#4322 …}
+reports: Doctrine\ORM\PersistentCollection {#4324 …}
+favourites: Doctrine\ORM\PersistentCollection {#4326 …}
+notifications: Doctrine\ORM\PersistentCollection {#4328 …}
-id: 250300
-bodyTs: "'everi':6 'need':9 'regex':3 'relearn':2 'scratch':5 'time':7 'use':11"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6231621"
+editedAt: null
+createdAt: DateTimeImmutable @1703478179 {#4313
date: 2023-12-25 05:22:59.0 +01:00
}
}
+root: App\Entity\EntryComment {#4317}
+body: "This is the way."
+lang: "en"
+isAdult: false
+favouriteCount: 6
+score: 0
+lastActive: DateTime @1703528682 {#5375
date: 2023-12-25 19:24:42.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@danc4498@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5379 …}
+nested: Doctrine\ORM\PersistentCollection {#5381 …}
+votes: Doctrine\ORM\PersistentCollection {#5383 …}
+reports: Doctrine\ORM\PersistentCollection {#5385 …}
+favourites: Doctrine\ORM\PersistentCollection {#5387 …}
+notifications: Doctrine\ORM\PersistentCollection {#5389 …}
-id: 251591
-bodyTs: "'way':4"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.dk/comment/4710715"
+editedAt: null
+createdAt: DateTimeImmutable @1703528682 {#5376
date: 2023-12-25 19:24:42.0 +01:00
}
} |
|
Show voter details
|
| 59 |
DENIED
|
edit
|
App\Entity\EntryComment {#5377
+user: Proxies\__CG__\App\Entity\User {#5378 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4317
+user: App\Entity\User {#4330 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "I relearn regex from scratch every time I need to use it."
+lang: "en"
+isAdult: false
+favouriteCount: 63
+score: 0
+lastActive: DateTime @1707749045 {#4312
date: 2024-02-12 15:44:05.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4318 …}
+nested: Doctrine\ORM\PersistentCollection {#4320 …}
+votes: Doctrine\ORM\PersistentCollection {#4322 …}
+reports: Doctrine\ORM\PersistentCollection {#4324 …}
+favourites: Doctrine\ORM\PersistentCollection {#4326 …}
+notifications: Doctrine\ORM\PersistentCollection {#4328 …}
-id: 250300
-bodyTs: "'everi':6 'need':9 'regex':3 'relearn':2 'scratch':5 'time':7 'use':11"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6231621"
+editedAt: null
+createdAt: DateTimeImmutable @1703478179 {#4313
date: 2023-12-25 05:22:59.0 +01:00
}
}
+root: App\Entity\EntryComment {#4317}
+body: "This is the way."
+lang: "en"
+isAdult: false
+favouriteCount: 6
+score: 0
+lastActive: DateTime @1703528682 {#5375
date: 2023-12-25 19:24:42.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@danc4498@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5379 …}
+nested: Doctrine\ORM\PersistentCollection {#5381 …}
+votes: Doctrine\ORM\PersistentCollection {#5383 …}
+reports: Doctrine\ORM\PersistentCollection {#5385 …}
+favourites: Doctrine\ORM\PersistentCollection {#5387 …}
+notifications: Doctrine\ORM\PersistentCollection {#5389 …}
-id: 251591
-bodyTs: "'way':4"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.dk/comment/4710715"
+editedAt: null
+createdAt: DateTimeImmutable @1703528682 {#5376
date: 2023-12-25 19:24:42.0 +01:00
}
} |
|
Show voter details
|
| 60 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5377
+user: Proxies\__CG__\App\Entity\User {#5378 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4317
+user: App\Entity\User {#4330 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "I relearn regex from scratch every time I need to use it."
+lang: "en"
+isAdult: false
+favouriteCount: 63
+score: 0
+lastActive: DateTime @1707749045 {#4312
date: 2024-02-12 15:44:05.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4318 …}
+nested: Doctrine\ORM\PersistentCollection {#4320 …}
+votes: Doctrine\ORM\PersistentCollection {#4322 …}
+reports: Doctrine\ORM\PersistentCollection {#4324 …}
+favourites: Doctrine\ORM\PersistentCollection {#4326 …}
+notifications: Doctrine\ORM\PersistentCollection {#4328 …}
-id: 250300
-bodyTs: "'everi':6 'need':9 'regex':3 'relearn':2 'scratch':5 'time':7 'use':11"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6231621"
+editedAt: null
+createdAt: DateTimeImmutable @1703478179 {#4313
date: 2023-12-25 05:22:59.0 +01:00
}
}
+root: App\Entity\EntryComment {#4317}
+body: "This is the way."
+lang: "en"
+isAdult: false
+favouriteCount: 6
+score: 0
+lastActive: DateTime @1703528682 {#5375
date: 2023-12-25 19:24:42.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@danc4498@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5379 …}
+nested: Doctrine\ORM\PersistentCollection {#5381 …}
+votes: Doctrine\ORM\PersistentCollection {#5383 …}
+reports: Doctrine\ORM\PersistentCollection {#5385 …}
+favourites: Doctrine\ORM\PersistentCollection {#5387 …}
+notifications: Doctrine\ORM\PersistentCollection {#5389 …}
-id: 251591
-bodyTs: "'way':4"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.dk/comment/4710715"
+editedAt: null
+createdAt: DateTimeImmutable @1703528682 {#5376
date: 2023-12-25 19:24:42.0 +01:00
}
} |
|
Show voter details
|
| 61 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 62 |
DENIED
|
moderate
|
App\Entity\EntryComment {#4390
+user: App\Entity\User {#4403 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "I stumbled upon this [regex crossword](https://jimbly.github.io/regex-crossword/) puzzle a while back. I was never good enough to get it, but it seems like it could be fun."
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703476894 {#4385
date: 2023-12-25 05:01:34.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4391 …}
+nested: Doctrine\ORM\PersistentCollection {#4393 …}
+votes: Doctrine\ORM\PersistentCollection {#4395 …}
+reports: Doctrine\ORM\PersistentCollection {#4397 …}
+favourites: Doctrine\ORM\PersistentCollection {#4399 …}
+notifications: Doctrine\ORM\PersistentCollection {#4401 …}
-id: 250269
-bodyTs: "'/regex-crossword/)':9 'back':13 'could':27 'crossword':6 'enough':18 'fun':29 'get':20 'good':17 'jimbly.github.io':8 'jimbly.github.io/regex-crossword/)':7 'like':25 'never':16 'puzzl':10 'regex':5 'seem':24 'stumbl':2 'upon':3"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6868043"
+editedAt: null
+createdAt: DateTimeImmutable @1703476894 {#4386
date: 2023-12-25 05:01:34.0 +01:00
}
} |
|
Show voter details
|
| 63 |
DENIED
|
edit
|
App\Entity\EntryComment {#4390
+user: App\Entity\User {#4403 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "I stumbled upon this [regex crossword](https://jimbly.github.io/regex-crossword/) puzzle a while back. I was never good enough to get it, but it seems like it could be fun."
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703476894 {#4385
date: 2023-12-25 05:01:34.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4391 …}
+nested: Doctrine\ORM\PersistentCollection {#4393 …}
+votes: Doctrine\ORM\PersistentCollection {#4395 …}
+reports: Doctrine\ORM\PersistentCollection {#4397 …}
+favourites: Doctrine\ORM\PersistentCollection {#4399 …}
+notifications: Doctrine\ORM\PersistentCollection {#4401 …}
-id: 250269
-bodyTs: "'/regex-crossword/)':9 'back':13 'could':27 'crossword':6 'enough':18 'fun':29 'get':20 'good':17 'jimbly.github.io':8 'jimbly.github.io/regex-crossword/)':7 'like':25 'never':16 'puzzl':10 'regex':5 'seem':24 'stumbl':2 'upon':3"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6868043"
+editedAt: null
+createdAt: DateTimeImmutable @1703476894 {#4386
date: 2023-12-25 05:01:34.0 +01:00
}
} |
|
Show voter details
|
| 64 |
DENIED
|
moderate
|
App\Entity\EntryComment {#4390
+user: App\Entity\User {#4403 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "I stumbled upon this [regex crossword](https://jimbly.github.io/regex-crossword/) puzzle a while back. I was never good enough to get it, but it seems like it could be fun."
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703476894 {#4385
date: 2023-12-25 05:01:34.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4391 …}
+nested: Doctrine\ORM\PersistentCollection {#4393 …}
+votes: Doctrine\ORM\PersistentCollection {#4395 …}
+reports: Doctrine\ORM\PersistentCollection {#4397 …}
+favourites: Doctrine\ORM\PersistentCollection {#4399 …}
+notifications: Doctrine\ORM\PersistentCollection {#4401 …}
-id: 250269
-bodyTs: "'/regex-crossword/)':9 'back':13 'could':27 'crossword':6 'enough':18 'fun':29 'get':20 'good':17 'jimbly.github.io':8 'jimbly.github.io/regex-crossword/)':7 'like':25 'never':16 'puzzl':10 'regex':5 'seem':24 'stumbl':2 'upon':3"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6868043"
+editedAt: null
+createdAt: DateTimeImmutable @1703476894 {#4386
date: 2023-12-25 05:01:34.0 +01:00
}
} |
|
Show voter details
|
| 65 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 66 |
DENIED
|
moderate
|
App\Entity\EntryComment {#4463
+user: App\Entity\User {#4476 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "Just to chip in because I haven't seen it mentioned yet, but I fing LLMs like ChatGPT or Microsoft Copilot are really good at making regexes and also at *explaining* regexes. So if you're learning them or just want to get the darned thing to work so you can go to bed those are a good resource."
+lang: "en"
+isAdult: false
+favouriteCount: 13
+score: 0
+lastActive: DateTime @1707656904 {#4458
date: 2024-02-11 14:08:24.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4464 …}
+nested: Doctrine\ORM\PersistentCollection {#4466 …}
+votes: Doctrine\ORM\PersistentCollection {#4468 …}
+reports: Doctrine\ORM\PersistentCollection {#4470 …}
+favourites: Doctrine\ORM\PersistentCollection {#4472 …}
+notifications: Doctrine\ORM\PersistentCollection {#4474 …}
-id: 250188
-bodyTs: "'also':29 'bed':54 'chatgpt':18 'chip':3 'copilot':21 'darn':45 'explain':31 'fing':15 'get':43 'go':52 'good':24,58 'haven':7 'learn':37 'like':17 'llms':16 'make':26 'mention':11 'microsoft':20 're':36 'realli':23 'regex':27,32 'resourc':59 'seen':9 'thing':46 'want':41 'work':48 'yet':12"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://kbin.social/m/linux@lemmy.ml/t/723399/-/comment/4294667"
+editedAt: null
+createdAt: DateTimeImmutable @1703473255 {#4459
date: 2023-12-25 04:00:55.0 +01:00
}
} |
|
Show voter details
|
| 67 |
DENIED
|
edit
|
App\Entity\EntryComment {#4463
+user: App\Entity\User {#4476 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "Just to chip in because I haven't seen it mentioned yet, but I fing LLMs like ChatGPT or Microsoft Copilot are really good at making regexes and also at *explaining* regexes. So if you're learning them or just want to get the darned thing to work so you can go to bed those are a good resource."
+lang: "en"
+isAdult: false
+favouriteCount: 13
+score: 0
+lastActive: DateTime @1707656904 {#4458
date: 2024-02-11 14:08:24.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4464 …}
+nested: Doctrine\ORM\PersistentCollection {#4466 …}
+votes: Doctrine\ORM\PersistentCollection {#4468 …}
+reports: Doctrine\ORM\PersistentCollection {#4470 …}
+favourites: Doctrine\ORM\PersistentCollection {#4472 …}
+notifications: Doctrine\ORM\PersistentCollection {#4474 …}
-id: 250188
-bodyTs: "'also':29 'bed':54 'chatgpt':18 'chip':3 'copilot':21 'darn':45 'explain':31 'fing':15 'get':43 'go':52 'good':24,58 'haven':7 'learn':37 'like':17 'llms':16 'make':26 'mention':11 'microsoft':20 're':36 'realli':23 'regex':27,32 'resourc':59 'seen':9 'thing':46 'want':41 'work':48 'yet':12"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://kbin.social/m/linux@lemmy.ml/t/723399/-/comment/4294667"
+editedAt: null
+createdAt: DateTimeImmutable @1703473255 {#4459
date: 2023-12-25 04:00:55.0 +01:00
}
} |
|
Show voter details
|
| 68 |
DENIED
|
moderate
|
App\Entity\EntryComment {#4463
+user: App\Entity\User {#4476 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "Just to chip in because I haven't seen it mentioned yet, but I fing LLMs like ChatGPT or Microsoft Copilot are really good at making regexes and also at *explaining* regexes. So if you're learning them or just want to get the darned thing to work so you can go to bed those are a good resource."
+lang: "en"
+isAdult: false
+favouriteCount: 13
+score: 0
+lastActive: DateTime @1707656904 {#4458
date: 2024-02-11 14:08:24.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4464 …}
+nested: Doctrine\ORM\PersistentCollection {#4466 …}
+votes: Doctrine\ORM\PersistentCollection {#4468 …}
+reports: Doctrine\ORM\PersistentCollection {#4470 …}
+favourites: Doctrine\ORM\PersistentCollection {#4472 …}
+notifications: Doctrine\ORM\PersistentCollection {#4474 …}
-id: 250188
-bodyTs: "'also':29 'bed':54 'chatgpt':18 'chip':3 'copilot':21 'darn':45 'explain':31 'fing':15 'get':43 'go':52 'good':24,58 'haven':7 'learn':37 'like':17 'llms':16 'make':26 'mention':11 'microsoft':20 're':36 'realli':23 'regex':27,32 'resourc':59 'seen':9 'thing':46 'want':41 'work':48 'yet':12"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://kbin.social/m/linux@lemmy.ml/t/723399/-/comment/4294667"
+editedAt: null
+createdAt: DateTimeImmutable @1703473255 {#4459
date: 2023-12-25 04:00:55.0 +01:00
}
} |
|
Show voter details
|
| 69 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 70 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5362
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4463
+user: App\Entity\User {#4476 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "Just to chip in because I haven't seen it mentioned yet, but I fing LLMs like ChatGPT or Microsoft Copilot are really good at making regexes and also at *explaining* regexes. So if you're learning them or just want to get the darned thing to work so you can go to bed those are a good resource."
+lang: "en"
+isAdult: false
+favouriteCount: 13
+score: 0
+lastActive: DateTime @1707656904 {#4458
date: 2024-02-11 14:08:24.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4464 …}
+nested: Doctrine\ORM\PersistentCollection {#4466 …}
+votes: Doctrine\ORM\PersistentCollection {#4468 …}
+reports: Doctrine\ORM\PersistentCollection {#4470 …}
+favourites: Doctrine\ORM\PersistentCollection {#4472 …}
+notifications: Doctrine\ORM\PersistentCollection {#4474 …}
-id: 250188
-bodyTs: "'also':29 'bed':54 'chatgpt':18 'chip':3 'copilot':21 'darn':45 'explain':31 'fing':15 'get':43 'go':52 'good':24,58 'haven':7 'learn':37 'like':17 'llms':16 'make':26 'mention':11 'microsoft':20 're':36 'realli':23 'regex':27,32 'resourc':59 'seen':9 'thing':46 'want':41 'work':48 'yet':12"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://kbin.social/m/linux@lemmy.ml/t/723399/-/comment/4294667"
+editedAt: null
+createdAt: DateTimeImmutable @1703473255 {#4459
date: 2023-12-25 04:00:55.0 +01:00
}
}
+root: App\Entity\EntryComment {#4463}
+body: "You know, I haven’t yet used ChatGPT for anything, I might check it out for this reason."
+lang: "en"
+isAdult: false
+favouriteCount: 4
+score: 0
+lastActive: DateTime @1703475868 {#5360
date: 2023-12-25 04:44:28.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@FaceDeer@kbin.social"
]
+children: Doctrine\ORM\PersistentCollection {#5363 …}
+nested: Doctrine\ORM\PersistentCollection {#5365 …}
+votes: Doctrine\ORM\PersistentCollection {#5367 …}
+reports: Doctrine\ORM\PersistentCollection {#5369 …}
+favourites: Doctrine\ORM\PersistentCollection {#5371 …}
+notifications: Doctrine\ORM\PersistentCollection {#5373 …}
-id: 250249
-bodyTs: "'anyth':10 'chatgpt':8 'check':13 'haven':4 'know':2 'might':12 'reason':18 'use':7 'yet':6"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6231243"
+editedAt: null
+createdAt: DateTimeImmutable @1703475868 {#5361
date: 2023-12-25 04:44:28.0 +01:00
}
} |
|
Show voter details
|
| 71 |
DENIED
|
edit
|
App\Entity\EntryComment {#5362
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4463
+user: App\Entity\User {#4476 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "Just to chip in because I haven't seen it mentioned yet, but I fing LLMs like ChatGPT or Microsoft Copilot are really good at making regexes and also at *explaining* regexes. So if you're learning them or just want to get the darned thing to work so you can go to bed those are a good resource."
+lang: "en"
+isAdult: false
+favouriteCount: 13
+score: 0
+lastActive: DateTime @1707656904 {#4458
date: 2024-02-11 14:08:24.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4464 …}
+nested: Doctrine\ORM\PersistentCollection {#4466 …}
+votes: Doctrine\ORM\PersistentCollection {#4468 …}
+reports: Doctrine\ORM\PersistentCollection {#4470 …}
+favourites: Doctrine\ORM\PersistentCollection {#4472 …}
+notifications: Doctrine\ORM\PersistentCollection {#4474 …}
-id: 250188
-bodyTs: "'also':29 'bed':54 'chatgpt':18 'chip':3 'copilot':21 'darn':45 'explain':31 'fing':15 'get':43 'go':52 'good':24,58 'haven':7 'learn':37 'like':17 'llms':16 'make':26 'mention':11 'microsoft':20 're':36 'realli':23 'regex':27,32 'resourc':59 'seen':9 'thing':46 'want':41 'work':48 'yet':12"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://kbin.social/m/linux@lemmy.ml/t/723399/-/comment/4294667"
+editedAt: null
+createdAt: DateTimeImmutable @1703473255 {#4459
date: 2023-12-25 04:00:55.0 +01:00
}
}
+root: App\Entity\EntryComment {#4463}
+body: "You know, I haven’t yet used ChatGPT for anything, I might check it out for this reason."
+lang: "en"
+isAdult: false
+favouriteCount: 4
+score: 0
+lastActive: DateTime @1703475868 {#5360
date: 2023-12-25 04:44:28.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@FaceDeer@kbin.social"
]
+children: Doctrine\ORM\PersistentCollection {#5363 …}
+nested: Doctrine\ORM\PersistentCollection {#5365 …}
+votes: Doctrine\ORM\PersistentCollection {#5367 …}
+reports: Doctrine\ORM\PersistentCollection {#5369 …}
+favourites: Doctrine\ORM\PersistentCollection {#5371 …}
+notifications: Doctrine\ORM\PersistentCollection {#5373 …}
-id: 250249
-bodyTs: "'anyth':10 'chatgpt':8 'check':13 'haven':4 'know':2 'might':12 'reason':18 'use':7 'yet':6"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6231243"
+editedAt: null
+createdAt: DateTimeImmutable @1703475868 {#5361
date: 2023-12-25 04:44:28.0 +01:00
}
} |
|
Show voter details
|
| 72 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5362
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4463
+user: App\Entity\User {#4476 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "Just to chip in because I haven't seen it mentioned yet, but I fing LLMs like ChatGPT or Microsoft Copilot are really good at making regexes and also at *explaining* regexes. So if you're learning them or just want to get the darned thing to work so you can go to bed those are a good resource."
+lang: "en"
+isAdult: false
+favouriteCount: 13
+score: 0
+lastActive: DateTime @1707656904 {#4458
date: 2024-02-11 14:08:24.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4464 …}
+nested: Doctrine\ORM\PersistentCollection {#4466 …}
+votes: Doctrine\ORM\PersistentCollection {#4468 …}
+reports: Doctrine\ORM\PersistentCollection {#4470 …}
+favourites: Doctrine\ORM\PersistentCollection {#4472 …}
+notifications: Doctrine\ORM\PersistentCollection {#4474 …}
-id: 250188
-bodyTs: "'also':29 'bed':54 'chatgpt':18 'chip':3 'copilot':21 'darn':45 'explain':31 'fing':15 'get':43 'go':52 'good':24,58 'haven':7 'learn':37 'like':17 'llms':16 'make':26 'mention':11 'microsoft':20 're':36 'realli':23 'regex':27,32 'resourc':59 'seen':9 'thing':46 'want':41 'work':48 'yet':12"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://kbin.social/m/linux@lemmy.ml/t/723399/-/comment/4294667"
+editedAt: null
+createdAt: DateTimeImmutable @1703473255 {#4459
date: 2023-12-25 04:00:55.0 +01:00
}
}
+root: App\Entity\EntryComment {#4463}
+body: "You know, I haven’t yet used ChatGPT for anything, I might check it out for this reason."
+lang: "en"
+isAdult: false
+favouriteCount: 4
+score: 0
+lastActive: DateTime @1703475868 {#5360
date: 2023-12-25 04:44:28.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@FaceDeer@kbin.social"
]
+children: Doctrine\ORM\PersistentCollection {#5363 …}
+nested: Doctrine\ORM\PersistentCollection {#5365 …}
+votes: Doctrine\ORM\PersistentCollection {#5367 …}
+reports: Doctrine\ORM\PersistentCollection {#5369 …}
+favourites: Doctrine\ORM\PersistentCollection {#5371 …}
+notifications: Doctrine\ORM\PersistentCollection {#5373 …}
-id: 250249
-bodyTs: "'anyth':10 'chatgpt':8 'check':13 'haven':4 'know':2 'might':12 'reason':18 'use':7 'yet':6"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6231243"
+editedAt: null
+createdAt: DateTimeImmutable @1703475868 {#5361
date: 2023-12-25 04:44:28.0 +01:00
}
} |
|
Show voter details
|
| 73 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 74 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5494
+user: Proxies\__CG__\App\Entity\User {#5495 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5362
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4463
+user: App\Entity\User {#4476 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "Just to chip in because I haven't seen it mentioned yet, but I fing LLMs like ChatGPT or Microsoft Copilot are really good at making regexes and also at *explaining* regexes. So if you're learning them or just want to get the darned thing to work so you can go to bed those are a good resource."
+lang: "en"
+isAdult: false
+favouriteCount: 13
+score: 0
+lastActive: DateTime @1707656904 {#4458
date: 2024-02-11 14:08:24.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4464 …}
+nested: Doctrine\ORM\PersistentCollection {#4466 …}
+votes: Doctrine\ORM\PersistentCollection {#4468 …}
+reports: Doctrine\ORM\PersistentCollection {#4470 …}
+favourites: Doctrine\ORM\PersistentCollection {#4472 …}
+notifications: Doctrine\ORM\PersistentCollection {#4474 …}
-id: 250188
-bodyTs: "'also':29 'bed':54 'chatgpt':18 'chip':3 'copilot':21 'darn':45 'explain':31 'fing':15 'get':43 'go':52 'good':24,58 'haven':7 'learn':37 'like':17 'llms':16 'make':26 'mention':11 'microsoft':20 're':36 'realli':23 'regex':27,32 'resourc':59 'seen':9 'thing':46 'want':41 'work':48 'yet':12"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://kbin.social/m/linux@lemmy.ml/t/723399/-/comment/4294667"
+editedAt: null
+createdAt: DateTimeImmutable @1703473255 {#4459
date: 2023-12-25 04:00:55.0 +01:00
}
}
+root: App\Entity\EntryComment {#4463}
+body: "You know, I haven’t yet used ChatGPT for anything, I might check it out for this reason."
+lang: "en"
+isAdult: false
+favouriteCount: 4
+score: 0
+lastActive: DateTime @1703475868 {#5360
date: 2023-12-25 04:44:28.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@FaceDeer@kbin.social"
]
+children: Doctrine\ORM\PersistentCollection {#5363 …}
+nested: Doctrine\ORM\PersistentCollection {#5365 …}
+votes: Doctrine\ORM\PersistentCollection {#5367 …}
+reports: Doctrine\ORM\PersistentCollection {#5369 …}
+favourites: Doctrine\ORM\PersistentCollection {#5371 …}
+notifications: Doctrine\ORM\PersistentCollection {#5373 …}
-id: 250249
-bodyTs: "'anyth':10 'chatgpt':8 'check':13 'haven':4 'know':2 'might':12 'reason':18 'use':7 'yet':6"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6231243"
+editedAt: null
+createdAt: DateTimeImmutable @1703475868 {#5361
date: 2023-12-25 04:44:28.0 +01:00
}
}
+root: App\Entity\EntryComment {#4463}
+body: "I use it to tell me which page of the Pathfinder 1e manual I should look on for the rules I need."
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703490416 {#5492
date: 2023-12-25 08:46:56.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@FaceDeer@kbin.social"
]
+children: Doctrine\ORM\PersistentCollection {#5496 …}
+nested: Doctrine\ORM\PersistentCollection {#5498 …}
+votes: Doctrine\ORM\PersistentCollection {#5500 …}
+reports: Doctrine\ORM\PersistentCollection {#5502 …}
+favourites: Doctrine\ORM\PersistentCollection {#5504 …}
+notifications: Doctrine\ORM\PersistentCollection {#5506 …}
-id: 250506
-bodyTs: "'1e':12 'look':16 'manual':13 'need':22 'page':8 'pathfind':11 'rule':20 'tell':5 'use':2"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6232964"
+editedAt: null
+createdAt: DateTimeImmutable @1703490416 {#5493
date: 2023-12-25 08:46:56.0 +01:00
}
} |
|
Show voter details
|
| 75 |
DENIED
|
edit
|
App\Entity\EntryComment {#5494
+user: Proxies\__CG__\App\Entity\User {#5495 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5362
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4463
+user: App\Entity\User {#4476 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "Just to chip in because I haven't seen it mentioned yet, but I fing LLMs like ChatGPT or Microsoft Copilot are really good at making regexes and also at *explaining* regexes. So if you're learning them or just want to get the darned thing to work so you can go to bed those are a good resource."
+lang: "en"
+isAdult: false
+favouriteCount: 13
+score: 0
+lastActive: DateTime @1707656904 {#4458
date: 2024-02-11 14:08:24.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4464 …}
+nested: Doctrine\ORM\PersistentCollection {#4466 …}
+votes: Doctrine\ORM\PersistentCollection {#4468 …}
+reports: Doctrine\ORM\PersistentCollection {#4470 …}
+favourites: Doctrine\ORM\PersistentCollection {#4472 …}
+notifications: Doctrine\ORM\PersistentCollection {#4474 …}
-id: 250188
-bodyTs: "'also':29 'bed':54 'chatgpt':18 'chip':3 'copilot':21 'darn':45 'explain':31 'fing':15 'get':43 'go':52 'good':24,58 'haven':7 'learn':37 'like':17 'llms':16 'make':26 'mention':11 'microsoft':20 're':36 'realli':23 'regex':27,32 'resourc':59 'seen':9 'thing':46 'want':41 'work':48 'yet':12"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://kbin.social/m/linux@lemmy.ml/t/723399/-/comment/4294667"
+editedAt: null
+createdAt: DateTimeImmutable @1703473255 {#4459
date: 2023-12-25 04:00:55.0 +01:00
}
}
+root: App\Entity\EntryComment {#4463}
+body: "You know, I haven’t yet used ChatGPT for anything, I might check it out for this reason."
+lang: "en"
+isAdult: false
+favouriteCount: 4
+score: 0
+lastActive: DateTime @1703475868 {#5360
date: 2023-12-25 04:44:28.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@FaceDeer@kbin.social"
]
+children: Doctrine\ORM\PersistentCollection {#5363 …}
+nested: Doctrine\ORM\PersistentCollection {#5365 …}
+votes: Doctrine\ORM\PersistentCollection {#5367 …}
+reports: Doctrine\ORM\PersistentCollection {#5369 …}
+favourites: Doctrine\ORM\PersistentCollection {#5371 …}
+notifications: Doctrine\ORM\PersistentCollection {#5373 …}
-id: 250249
-bodyTs: "'anyth':10 'chatgpt':8 'check':13 'haven':4 'know':2 'might':12 'reason':18 'use':7 'yet':6"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6231243"
+editedAt: null
+createdAt: DateTimeImmutable @1703475868 {#5361
date: 2023-12-25 04:44:28.0 +01:00
}
}
+root: App\Entity\EntryComment {#4463}
+body: "I use it to tell me which page of the Pathfinder 1e manual I should look on for the rules I need."
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703490416 {#5492
date: 2023-12-25 08:46:56.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@FaceDeer@kbin.social"
]
+children: Doctrine\ORM\PersistentCollection {#5496 …}
+nested: Doctrine\ORM\PersistentCollection {#5498 …}
+votes: Doctrine\ORM\PersistentCollection {#5500 …}
+reports: Doctrine\ORM\PersistentCollection {#5502 …}
+favourites: Doctrine\ORM\PersistentCollection {#5504 …}
+notifications: Doctrine\ORM\PersistentCollection {#5506 …}
-id: 250506
-bodyTs: "'1e':12 'look':16 'manual':13 'need':22 'page':8 'pathfind':11 'rule':20 'tell':5 'use':2"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6232964"
+editedAt: null
+createdAt: DateTimeImmutable @1703490416 {#5493
date: 2023-12-25 08:46:56.0 +01:00
}
} |
|
Show voter details
|
| 76 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5494
+user: Proxies\__CG__\App\Entity\User {#5495 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5362
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4463
+user: App\Entity\User {#4476 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "Just to chip in because I haven't seen it mentioned yet, but I fing LLMs like ChatGPT or Microsoft Copilot are really good at making regexes and also at *explaining* regexes. So if you're learning them or just want to get the darned thing to work so you can go to bed those are a good resource."
+lang: "en"
+isAdult: false
+favouriteCount: 13
+score: 0
+lastActive: DateTime @1707656904 {#4458
date: 2024-02-11 14:08:24.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4464 …}
+nested: Doctrine\ORM\PersistentCollection {#4466 …}
+votes: Doctrine\ORM\PersistentCollection {#4468 …}
+reports: Doctrine\ORM\PersistentCollection {#4470 …}
+favourites: Doctrine\ORM\PersistentCollection {#4472 …}
+notifications: Doctrine\ORM\PersistentCollection {#4474 …}
-id: 250188
-bodyTs: "'also':29 'bed':54 'chatgpt':18 'chip':3 'copilot':21 'darn':45 'explain':31 'fing':15 'get':43 'go':52 'good':24,58 'haven':7 'learn':37 'like':17 'llms':16 'make':26 'mention':11 'microsoft':20 're':36 'realli':23 'regex':27,32 'resourc':59 'seen':9 'thing':46 'want':41 'work':48 'yet':12"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://kbin.social/m/linux@lemmy.ml/t/723399/-/comment/4294667"
+editedAt: null
+createdAt: DateTimeImmutable @1703473255 {#4459
date: 2023-12-25 04:00:55.0 +01:00
}
}
+root: App\Entity\EntryComment {#4463}
+body: "You know, I haven’t yet used ChatGPT for anything, I might check it out for this reason."
+lang: "en"
+isAdult: false
+favouriteCount: 4
+score: 0
+lastActive: DateTime @1703475868 {#5360
date: 2023-12-25 04:44:28.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@FaceDeer@kbin.social"
]
+children: Doctrine\ORM\PersistentCollection {#5363 …}
+nested: Doctrine\ORM\PersistentCollection {#5365 …}
+votes: Doctrine\ORM\PersistentCollection {#5367 …}
+reports: Doctrine\ORM\PersistentCollection {#5369 …}
+favourites: Doctrine\ORM\PersistentCollection {#5371 …}
+notifications: Doctrine\ORM\PersistentCollection {#5373 …}
-id: 250249
-bodyTs: "'anyth':10 'chatgpt':8 'check':13 'haven':4 'know':2 'might':12 'reason':18 'use':7 'yet':6"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6231243"
+editedAt: null
+createdAt: DateTimeImmutable @1703475868 {#5361
date: 2023-12-25 04:44:28.0 +01:00
}
}
+root: App\Entity\EntryComment {#4463}
+body: "I use it to tell me which page of the Pathfinder 1e manual I should look on for the rules I need."
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703490416 {#5492
date: 2023-12-25 08:46:56.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@FaceDeer@kbin.social"
]
+children: Doctrine\ORM\PersistentCollection {#5496 …}
+nested: Doctrine\ORM\PersistentCollection {#5498 …}
+votes: Doctrine\ORM\PersistentCollection {#5500 …}
+reports: Doctrine\ORM\PersistentCollection {#5502 …}
+favourites: Doctrine\ORM\PersistentCollection {#5504 …}
+notifications: Doctrine\ORM\PersistentCollection {#5506 …}
-id: 250506
-bodyTs: "'1e':12 'look':16 'manual':13 'need':22 'page':8 'pathfind':11 'rule':20 'tell':5 'use':2"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6232964"
+editedAt: null
+createdAt: DateTimeImmutable @1703490416 {#5493
date: 2023-12-25 08:46:56.0 +01:00
}
} |
|
Show voter details
|
| 77 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 78 |
DENIED
|
moderate
|
App\Entity\EntryComment {#4538
+user: App\Entity\User {#4551 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "Just adding my congrats. Good job, OP. Regex is super useful stuff."
+lang: "en"
+isAdult: false
+favouriteCount: 10
+score: 0
+lastActive: DateTime @1707606786 {#4533
date: 2024-02-11 00:13:06.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4539 …}
+nested: Doctrine\ORM\PersistentCollection {#4541 …}
+votes: Doctrine\ORM\PersistentCollection {#4543 …}
+reports: Doctrine\ORM\PersistentCollection {#4545 …}
+favourites: Doctrine\ORM\PersistentCollection {#4547 …}
+notifications: Doctrine\ORM\PersistentCollection {#4549 …}
-id: 249984
-bodyTs: "'ad':2 'congrat':4 'good':5 'job':6 'op':7 'regex':8 'stuff':12 'super':10 'use':11"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6865933"
+editedAt: null
+createdAt: DateTimeImmutable @1703466032 {#4534
date: 2023-12-25 02:00:32.0 +01:00
}
} |
|
Show voter details
|
| 79 |
DENIED
|
edit
|
App\Entity\EntryComment {#4538
+user: App\Entity\User {#4551 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "Just adding my congrats. Good job, OP. Regex is super useful stuff."
+lang: "en"
+isAdult: false
+favouriteCount: 10
+score: 0
+lastActive: DateTime @1707606786 {#4533
date: 2024-02-11 00:13:06.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4539 …}
+nested: Doctrine\ORM\PersistentCollection {#4541 …}
+votes: Doctrine\ORM\PersistentCollection {#4543 …}
+reports: Doctrine\ORM\PersistentCollection {#4545 …}
+favourites: Doctrine\ORM\PersistentCollection {#4547 …}
+notifications: Doctrine\ORM\PersistentCollection {#4549 …}
-id: 249984
-bodyTs: "'ad':2 'congrat':4 'good':5 'job':6 'op':7 'regex':8 'stuff':12 'super':10 'use':11"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6865933"
+editedAt: null
+createdAt: DateTimeImmutable @1703466032 {#4534
date: 2023-12-25 02:00:32.0 +01:00
}
} |
|
Show voter details
|
| 80 |
DENIED
|
moderate
|
App\Entity\EntryComment {#4538
+user: App\Entity\User {#4551 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "Just adding my congrats. Good job, OP. Regex is super useful stuff."
+lang: "en"
+isAdult: false
+favouriteCount: 10
+score: 0
+lastActive: DateTime @1707606786 {#4533
date: 2024-02-11 00:13:06.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4539 …}
+nested: Doctrine\ORM\PersistentCollection {#4541 …}
+votes: Doctrine\ORM\PersistentCollection {#4543 …}
+reports: Doctrine\ORM\PersistentCollection {#4545 …}
+favourites: Doctrine\ORM\PersistentCollection {#4547 …}
+notifications: Doctrine\ORM\PersistentCollection {#4549 …}
-id: 249984
-bodyTs: "'ad':2 'congrat':4 'good':5 'job':6 'op':7 'regex':8 'stuff':12 'super':10 'use':11"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6865933"
+editedAt: null
+createdAt: DateTimeImmutable @1703466032 {#4534
date: 2023-12-25 02:00:32.0 +01:00
}
} |
|
Show voter details
|
| 81 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 82 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5347
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4538
+user: App\Entity\User {#4551 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "Just adding my congrats. Good job, OP. Regex is super useful stuff."
+lang: "en"
+isAdult: false
+favouriteCount: 10
+score: 0
+lastActive: DateTime @1707606786 {#4533
date: 2024-02-11 00:13:06.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4539 …}
+nested: Doctrine\ORM\PersistentCollection {#4541 …}
+votes: Doctrine\ORM\PersistentCollection {#4543 …}
+reports: Doctrine\ORM\PersistentCollection {#4545 …}
+favourites: Doctrine\ORM\PersistentCollection {#4547 …}
+notifications: Doctrine\ORM\PersistentCollection {#4549 …}
-id: 249984
-bodyTs: "'ad':2 'congrat':4 'good':5 'job':6 'op':7 'regex':8 'stuff':12 'super':10 'use':11"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6865933"
+editedAt: null
+createdAt: DateTimeImmutable @1703466032 {#4534
date: 2023-12-25 02:00:32.0 +01:00
}
}
+root: App\Entity\EntryComment {#4538}
+body: "Thank you!!!"
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703471226 {#5345
date: 2023-12-25 03:27:06.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@Trent@lemmy.ml"
]
+children: Doctrine\ORM\PersistentCollection {#5348 …}
+nested: Doctrine\ORM\PersistentCollection {#5350 …}
+votes: Doctrine\ORM\PersistentCollection {#5352 …}
+reports: Doctrine\ORM\PersistentCollection {#5354 …}
+favourites: Doctrine\ORM\PersistentCollection {#5356 …}
+notifications: Doctrine\ORM\PersistentCollection {#5358 …}
-id: 250117
-bodyTs: "'thank':1"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230475"
+editedAt: null
+createdAt: DateTimeImmutable @1703471226 {#5346
date: 2023-12-25 03:27:06.0 +01:00
}
} |
|
Show voter details
|
| 83 |
DENIED
|
edit
|
App\Entity\EntryComment {#5347
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4538
+user: App\Entity\User {#4551 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "Just adding my congrats. Good job, OP. Regex is super useful stuff."
+lang: "en"
+isAdult: false
+favouriteCount: 10
+score: 0
+lastActive: DateTime @1707606786 {#4533
date: 2024-02-11 00:13:06.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4539 …}
+nested: Doctrine\ORM\PersistentCollection {#4541 …}
+votes: Doctrine\ORM\PersistentCollection {#4543 …}
+reports: Doctrine\ORM\PersistentCollection {#4545 …}
+favourites: Doctrine\ORM\PersistentCollection {#4547 …}
+notifications: Doctrine\ORM\PersistentCollection {#4549 …}
-id: 249984
-bodyTs: "'ad':2 'congrat':4 'good':5 'job':6 'op':7 'regex':8 'stuff':12 'super':10 'use':11"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6865933"
+editedAt: null
+createdAt: DateTimeImmutable @1703466032 {#4534
date: 2023-12-25 02:00:32.0 +01:00
}
}
+root: App\Entity\EntryComment {#4538}
+body: "Thank you!!!"
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703471226 {#5345
date: 2023-12-25 03:27:06.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@Trent@lemmy.ml"
]
+children: Doctrine\ORM\PersistentCollection {#5348 …}
+nested: Doctrine\ORM\PersistentCollection {#5350 …}
+votes: Doctrine\ORM\PersistentCollection {#5352 …}
+reports: Doctrine\ORM\PersistentCollection {#5354 …}
+favourites: Doctrine\ORM\PersistentCollection {#5356 …}
+notifications: Doctrine\ORM\PersistentCollection {#5358 …}
-id: 250117
-bodyTs: "'thank':1"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230475"
+editedAt: null
+createdAt: DateTimeImmutable @1703471226 {#5346
date: 2023-12-25 03:27:06.0 +01:00
}
} |
|
Show voter details
|
| 84 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5347
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4538
+user: App\Entity\User {#4551 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "Just adding my congrats. Good job, OP. Regex is super useful stuff."
+lang: "en"
+isAdult: false
+favouriteCount: 10
+score: 0
+lastActive: DateTime @1707606786 {#4533
date: 2024-02-11 00:13:06.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4539 …}
+nested: Doctrine\ORM\PersistentCollection {#4541 …}
+votes: Doctrine\ORM\PersistentCollection {#4543 …}
+reports: Doctrine\ORM\PersistentCollection {#4545 …}
+favourites: Doctrine\ORM\PersistentCollection {#4547 …}
+notifications: Doctrine\ORM\PersistentCollection {#4549 …}
-id: 249984
-bodyTs: "'ad':2 'congrat':4 'good':5 'job':6 'op':7 'regex':8 'stuff':12 'super':10 'use':11"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6865933"
+editedAt: null
+createdAt: DateTimeImmutable @1703466032 {#4534
date: 2023-12-25 02:00:32.0 +01:00
}
}
+root: App\Entity\EntryComment {#4538}
+body: "Thank you!!!"
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703471226 {#5345
date: 2023-12-25 03:27:06.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@Trent@lemmy.ml"
]
+children: Doctrine\ORM\PersistentCollection {#5348 …}
+nested: Doctrine\ORM\PersistentCollection {#5350 …}
+votes: Doctrine\ORM\PersistentCollection {#5352 …}
+reports: Doctrine\ORM\PersistentCollection {#5354 …}
+favourites: Doctrine\ORM\PersistentCollection {#5356 …}
+notifications: Doctrine\ORM\PersistentCollection {#5358 …}
-id: 250117
-bodyTs: "'thank':1"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230475"
+editedAt: null
+createdAt: DateTimeImmutable @1703471226 {#5346
date: 2023-12-25 03:27:06.0 +01:00
}
} |
|
Show voter details
|
| 85 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 86 |
DENIED
|
moderate
|
App\Entity\EntryComment {#4612
+user: App\Entity\User {#4625 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
I can also recommend the book the TS mentioned, it is very good and after reading it you will understand regular expressions. It’s fine to use a cheat sheet if you want, cause if you don’t do it regularly the knowledge can sag, but the understanding is what matters. Also depending on the context, different implementations can have slightly different syntax or modifiers to be aware of.\n
\n
I lent out the book to my brother once and he somehow lost it, so I never got it back. Don’t lend out book guys.\n
\n
And remember not everything can be solved using a regular expression: [xkcd.com/1171/](https://xkcd.com/1171/)
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703459900 {#4606
date: 2023-12-25 00:18:20.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4613 …}
+nested: Doctrine\ORM\PersistentCollection {#4615 …}
+votes: Doctrine\ORM\PersistentCollection {#4617 …}
+reports: Doctrine\ORM\PersistentCollection {#4619 …}
+favourites: Doctrine\ORM\PersistentCollection {#4621 …}
+notifications: Doctrine\ORM\PersistentCollection {#4623 …}
-id: 249788
-bodyTs: "'/1171/](https://xkcd.com/1171/)':109 'also':3,52 'awar':68 'back':89 'book':6,74,94 'brother':77 'caus':34 'cheat':29 'context':56 'depend':53 'differ':57,62 'everyth':99 'express':22,106 'fine':25 'good':13 'got':87 'guy':95 'implement':58 'knowledg':43 'lend':92 'lent':71 'lost':82 'matter':51 'mention':9 'modifi':65 'never':86 'read':16 'recommend':4 'regular':21,41,105 'rememb':97 'sag':45 'sheet':30 'slight':61 'solv':102 'somehow':81 'syntax':63 'ts':8 'understand':20,48 'use':27,103 'want':33 'xkcd.com':108 'xkcd.com/1171/](https://xkcd.com/1171/)':107"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5556062"
+editedAt: DateTimeImmutable @1707581149 {#4607
date: 2024-02-10 17:05:49.0 +01:00
}
+createdAt: DateTimeImmutable @1703459900 {#4608
date: 2023-12-25 00:18:20.0 +01:00
}
} |
|
Show voter details
|
| 87 |
DENIED
|
edit
|
App\Entity\EntryComment {#4612
+user: App\Entity\User {#4625 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
I can also recommend the book the TS mentioned, it is very good and after reading it you will understand regular expressions. It’s fine to use a cheat sheet if you want, cause if you don’t do it regularly the knowledge can sag, but the understanding is what matters. Also depending on the context, different implementations can have slightly different syntax or modifiers to be aware of.\n
\n
I lent out the book to my brother once and he somehow lost it, so I never got it back. Don’t lend out book guys.\n
\n
And remember not everything can be solved using a regular expression: [xkcd.com/1171/](https://xkcd.com/1171/)
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703459900 {#4606
date: 2023-12-25 00:18:20.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4613 …}
+nested: Doctrine\ORM\PersistentCollection {#4615 …}
+votes: Doctrine\ORM\PersistentCollection {#4617 …}
+reports: Doctrine\ORM\PersistentCollection {#4619 …}
+favourites: Doctrine\ORM\PersistentCollection {#4621 …}
+notifications: Doctrine\ORM\PersistentCollection {#4623 …}
-id: 249788
-bodyTs: "'/1171/](https://xkcd.com/1171/)':109 'also':3,52 'awar':68 'back':89 'book':6,74,94 'brother':77 'caus':34 'cheat':29 'context':56 'depend':53 'differ':57,62 'everyth':99 'express':22,106 'fine':25 'good':13 'got':87 'guy':95 'implement':58 'knowledg':43 'lend':92 'lent':71 'lost':82 'matter':51 'mention':9 'modifi':65 'never':86 'read':16 'recommend':4 'regular':21,41,105 'rememb':97 'sag':45 'sheet':30 'slight':61 'solv':102 'somehow':81 'syntax':63 'ts':8 'understand':20,48 'use':27,103 'want':33 'xkcd.com':108 'xkcd.com/1171/](https://xkcd.com/1171/)':107"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5556062"
+editedAt: DateTimeImmutable @1707581149 {#4607
date: 2024-02-10 17:05:49.0 +01:00
}
+createdAt: DateTimeImmutable @1703459900 {#4608
date: 2023-12-25 00:18:20.0 +01:00
}
} |
|
Show voter details
|
| 88 |
DENIED
|
moderate
|
App\Entity\EntryComment {#4612
+user: App\Entity\User {#4625 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
I can also recommend the book the TS mentioned, it is very good and after reading it you will understand regular expressions. It’s fine to use a cheat sheet if you want, cause if you don’t do it regularly the knowledge can sag, but the understanding is what matters. Also depending on the context, different implementations can have slightly different syntax or modifiers to be aware of.\n
\n
I lent out the book to my brother once and he somehow lost it, so I never got it back. Don’t lend out book guys.\n
\n
And remember not everything can be solved using a regular expression: [xkcd.com/1171/](https://xkcd.com/1171/)
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1703459900 {#4606
date: 2023-12-25 00:18:20.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4613 …}
+nested: Doctrine\ORM\PersistentCollection {#4615 …}
+votes: Doctrine\ORM\PersistentCollection {#4617 …}
+reports: Doctrine\ORM\PersistentCollection {#4619 …}
+favourites: Doctrine\ORM\PersistentCollection {#4621 …}
+notifications: Doctrine\ORM\PersistentCollection {#4623 …}
-id: 249788
-bodyTs: "'/1171/](https://xkcd.com/1171/)':109 'also':3,52 'awar':68 'back':89 'book':6,74,94 'brother':77 'caus':34 'cheat':29 'context':56 'depend':53 'differ':57,62 'everyth':99 'express':22,106 'fine':25 'good':13 'got':87 'guy':95 'implement':58 'knowledg':43 'lend':92 'lent':71 'lost':82 'matter':51 'mention':9 'modifi':65 'never':86 'read':16 'recommend':4 'regular':21,41,105 'rememb':97 'sag':45 'sheet':30 'slight':61 'solv':102 'somehow':81 'syntax':63 'ts':8 'understand':20,48 'use':27,103 'want':33 'xkcd.com':108 'xkcd.com/1171/](https://xkcd.com/1171/)':107"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://feddit.nl/comment/5556062"
+editedAt: DateTimeImmutable @1707581149 {#4607
date: 2024-02-10 17:05:49.0 +01:00
}
+createdAt: DateTimeImmutable @1703459900 {#4608
date: 2023-12-25 00:18:20.0 +01:00
}
} |
|
Show voter details
|
| 89 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 90 |
DENIED
|
moderate
|
App\Entity\EntryComment {#4685
+user: App\Entity\User {#4698 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
I think the most impressive part of this is that your wife cares.\n
\n
...does she have a sister?
"""
+lang: "en"
+isAdult: false
+favouriteCount: 5
+score: 0
+lastActive: DateTime @1707607495 {#4680
date: 2024-02-11 00:24:55.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4686 …}
+nested: Doctrine\ORM\PersistentCollection {#4688 …}
+votes: Doctrine\ORM\PersistentCollection {#4690 …}
+reports: Doctrine\ORM\PersistentCollection {#4692 …}
+favourites: Doctrine\ORM\PersistentCollection {#4694 …}
+notifications: Doctrine\ORM\PersistentCollection {#4696 …}
-id: 249792
-bodyTs: "'care':13 'impress':5 'part':6 'sister':18 'think':2 'wife':12"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://kbin.social/m/linux@lemmy.ml/t/723399/-/comment/4292558"
+editedAt: null
+createdAt: DateTimeImmutable @1703459627 {#4681
date: 2023-12-25 00:13:47.0 +01:00
}
} |
|
Show voter details
|
| 91 |
DENIED
|
edit
|
App\Entity\EntryComment {#4685
+user: App\Entity\User {#4698 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
I think the most impressive part of this is that your wife cares.\n
\n
...does she have a sister?
"""
+lang: "en"
+isAdult: false
+favouriteCount: 5
+score: 0
+lastActive: DateTime @1707607495 {#4680
date: 2024-02-11 00:24:55.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4686 …}
+nested: Doctrine\ORM\PersistentCollection {#4688 …}
+votes: Doctrine\ORM\PersistentCollection {#4690 …}
+reports: Doctrine\ORM\PersistentCollection {#4692 …}
+favourites: Doctrine\ORM\PersistentCollection {#4694 …}
+notifications: Doctrine\ORM\PersistentCollection {#4696 …}
-id: 249792
-bodyTs: "'care':13 'impress':5 'part':6 'sister':18 'think':2 'wife':12"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://kbin.social/m/linux@lemmy.ml/t/723399/-/comment/4292558"
+editedAt: null
+createdAt: DateTimeImmutable @1703459627 {#4681
date: 2023-12-25 00:13:47.0 +01:00
}
} |
|
Show voter details
|
| 92 |
DENIED
|
moderate
|
App\Entity\EntryComment {#4685
+user: App\Entity\User {#4698 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
I think the most impressive part of this is that your wife cares.\n
\n
...does she have a sister?
"""
+lang: "en"
+isAdult: false
+favouriteCount: 5
+score: 0
+lastActive: DateTime @1707607495 {#4680
date: 2024-02-11 00:24:55.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4686 …}
+nested: Doctrine\ORM\PersistentCollection {#4688 …}
+votes: Doctrine\ORM\PersistentCollection {#4690 …}
+reports: Doctrine\ORM\PersistentCollection {#4692 …}
+favourites: Doctrine\ORM\PersistentCollection {#4694 …}
+notifications: Doctrine\ORM\PersistentCollection {#4696 …}
-id: 249792
-bodyTs: "'care':13 'impress':5 'part':6 'sister':18 'think':2 'wife':12"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://kbin.social/m/linux@lemmy.ml/t/723399/-/comment/4292558"
+editedAt: null
+createdAt: DateTimeImmutable @1703459627 {#4681
date: 2023-12-25 00:13:47.0 +01:00
}
} |
|
Show voter details
|
| 93 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 94 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5316
+user: Proxies\__CG__\App\Entity\User {#5317 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4685
+user: App\Entity\User {#4698 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
I think the most impressive part of this is that your wife cares.\n
\n
...does she have a sister?
"""
+lang: "en"
+isAdult: false
+favouriteCount: 5
+score: 0
+lastActive: DateTime @1707607495 {#4680
date: 2024-02-11 00:24:55.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4686 …}
+nested: Doctrine\ORM\PersistentCollection {#4688 …}
+votes: Doctrine\ORM\PersistentCollection {#4690 …}
+reports: Doctrine\ORM\PersistentCollection {#4692 …}
+favourites: Doctrine\ORM\PersistentCollection {#4694 …}
+notifications: Doctrine\ORM\PersistentCollection {#4696 …}
-id: 249792
-bodyTs: "'care':13 'impress':5 'part':6 'sister':18 'think':2 'wife':12"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://kbin.social/m/linux@lemmy.ml/t/723399/-/comment/4292558"
+editedAt: null
+createdAt: DateTimeImmutable @1703459627 {#4681
date: 2023-12-25 00:13:47.0 +01:00
}
}
+root: App\Entity\EntryComment {#4685}
+body: """
I'm currently seeing a girl I started dating after she had problems with her regex and I helped her out.\n
\n
So far so good.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 2
+score: 0
+lastActive: DateTime @1703462159 {#5314
date: 2023-12-25 00:55:59.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@prowess2956@kbin.social"
]
+children: Doctrine\ORM\PersistentCollection {#5318 …}
+nested: Doctrine\ORM\PersistentCollection {#5320 …}
+votes: Doctrine\ORM\PersistentCollection {#5322 …}
+reports: Doctrine\ORM\PersistentCollection {#5324 …}
+favourites: Doctrine\ORM\PersistentCollection {#5326 …}
+notifications: Doctrine\ORM\PersistentCollection {#5328 …}
-id: 249878
-bodyTs: "'current':3 'date':9 'far':23 'girl':6 'good':25 'help':19 'm':2 'problem':13 'regex':16 'see':4 'start':8"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://kbin.social/m/linux@lemmy.ml/t/723399/-/comment/4293000"
+editedAt: null
+createdAt: DateTimeImmutable @1703462159 {#5315
date: 2023-12-25 00:55:59.0 +01:00
}
} |
|
Show voter details
|
| 95 |
DENIED
|
edit
|
App\Entity\EntryComment {#5316
+user: Proxies\__CG__\App\Entity\User {#5317 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4685
+user: App\Entity\User {#4698 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
I think the most impressive part of this is that your wife cares.\n
\n
...does she have a sister?
"""
+lang: "en"
+isAdult: false
+favouriteCount: 5
+score: 0
+lastActive: DateTime @1707607495 {#4680
date: 2024-02-11 00:24:55.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4686 …}
+nested: Doctrine\ORM\PersistentCollection {#4688 …}
+votes: Doctrine\ORM\PersistentCollection {#4690 …}
+reports: Doctrine\ORM\PersistentCollection {#4692 …}
+favourites: Doctrine\ORM\PersistentCollection {#4694 …}
+notifications: Doctrine\ORM\PersistentCollection {#4696 …}
-id: 249792
-bodyTs: "'care':13 'impress':5 'part':6 'sister':18 'think':2 'wife':12"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://kbin.social/m/linux@lemmy.ml/t/723399/-/comment/4292558"
+editedAt: null
+createdAt: DateTimeImmutable @1703459627 {#4681
date: 2023-12-25 00:13:47.0 +01:00
}
}
+root: App\Entity\EntryComment {#4685}
+body: """
I'm currently seeing a girl I started dating after she had problems with her regex and I helped her out.\n
\n
So far so good.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 2
+score: 0
+lastActive: DateTime @1703462159 {#5314
date: 2023-12-25 00:55:59.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@prowess2956@kbin.social"
]
+children: Doctrine\ORM\PersistentCollection {#5318 …}
+nested: Doctrine\ORM\PersistentCollection {#5320 …}
+votes: Doctrine\ORM\PersistentCollection {#5322 …}
+reports: Doctrine\ORM\PersistentCollection {#5324 …}
+favourites: Doctrine\ORM\PersistentCollection {#5326 …}
+notifications: Doctrine\ORM\PersistentCollection {#5328 …}
-id: 249878
-bodyTs: "'current':3 'date':9 'far':23 'girl':6 'good':25 'help':19 'm':2 'problem':13 'regex':16 'see':4 'start':8"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://kbin.social/m/linux@lemmy.ml/t/723399/-/comment/4293000"
+editedAt: null
+createdAt: DateTimeImmutable @1703462159 {#5315
date: 2023-12-25 00:55:59.0 +01:00
}
} |
|
Show voter details
|
| 96 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5316
+user: Proxies\__CG__\App\Entity\User {#5317 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4685
+user: App\Entity\User {#4698 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
I think the most impressive part of this is that your wife cares.\n
\n
...does she have a sister?
"""
+lang: "en"
+isAdult: false
+favouriteCount: 5
+score: 0
+lastActive: DateTime @1707607495 {#4680
date: 2024-02-11 00:24:55.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4686 …}
+nested: Doctrine\ORM\PersistentCollection {#4688 …}
+votes: Doctrine\ORM\PersistentCollection {#4690 …}
+reports: Doctrine\ORM\PersistentCollection {#4692 …}
+favourites: Doctrine\ORM\PersistentCollection {#4694 …}
+notifications: Doctrine\ORM\PersistentCollection {#4696 …}
-id: 249792
-bodyTs: "'care':13 'impress':5 'part':6 'sister':18 'think':2 'wife':12"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://kbin.social/m/linux@lemmy.ml/t/723399/-/comment/4292558"
+editedAt: null
+createdAt: DateTimeImmutable @1703459627 {#4681
date: 2023-12-25 00:13:47.0 +01:00
}
}
+root: App\Entity\EntryComment {#4685}
+body: """
I'm currently seeing a girl I started dating after she had problems with her regex and I helped her out.\n
\n
So far so good.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 2
+score: 0
+lastActive: DateTime @1703462159 {#5314
date: 2023-12-25 00:55:59.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@prowess2956@kbin.social"
]
+children: Doctrine\ORM\PersistentCollection {#5318 …}
+nested: Doctrine\ORM\PersistentCollection {#5320 …}
+votes: Doctrine\ORM\PersistentCollection {#5322 …}
+reports: Doctrine\ORM\PersistentCollection {#5324 …}
+favourites: Doctrine\ORM\PersistentCollection {#5326 …}
+notifications: Doctrine\ORM\PersistentCollection {#5328 …}
-id: 249878
-bodyTs: "'current':3 'date':9 'far':23 'girl':6 'good':25 'help':19 'm':2 'problem':13 'regex':16 'see':4 'start':8"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://kbin.social/m/linux@lemmy.ml/t/723399/-/comment/4293000"
+editedAt: null
+createdAt: DateTimeImmutable @1703462159 {#5315
date: 2023-12-25 00:55:59.0 +01:00
}
} |
|
Show voter details
|
| 97 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 98 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5332
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4685
+user: App\Entity\User {#4698 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
I think the most impressive part of this is that your wife cares.\n
\n
...does she have a sister?
"""
+lang: "en"
+isAdult: false
+favouriteCount: 5
+score: 0
+lastActive: DateTime @1707607495 {#4680
date: 2024-02-11 00:24:55.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4686 …}
+nested: Doctrine\ORM\PersistentCollection {#4688 …}
+votes: Doctrine\ORM\PersistentCollection {#4690 …}
+reports: Doctrine\ORM\PersistentCollection {#4692 …}
+favourites: Doctrine\ORM\PersistentCollection {#4694 …}
+notifications: Doctrine\ORM\PersistentCollection {#4696 …}
-id: 249792
-bodyTs: "'care':13 'impress':5 'part':6 'sister':18 'think':2 'wife':12"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://kbin.social/m/linux@lemmy.ml/t/723399/-/comment/4292558"
+editedAt: null
+createdAt: DateTimeImmutable @1703459627 {#4681
date: 2023-12-25 00:13:47.0 +01:00
}
}
+root: App\Entity\EntryComment {#4685}
+body: "She does but, I’d stay away from the sister. 🤣"
+lang: "en"
+isAdult: false
+favouriteCount: 0
+score: 0
+lastActive: DateTime @1703471560 {#5330
date: 2023-12-25 03:32:40.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@prowess2956@kbin.social"
]
+children: Doctrine\ORM\PersistentCollection {#5333 …}
+nested: Doctrine\ORM\PersistentCollection {#5335 …}
+votes: Doctrine\ORM\PersistentCollection {#5337 …}
+reports: Doctrine\ORM\PersistentCollection {#5339 …}
+favourites: Doctrine\ORM\PersistentCollection {#5341 …}
+notifications: Doctrine\ORM\PersistentCollection {#5343 …}
-id: 250127
-bodyTs: "'away':7 'd':5 'sister':10 'stay':6"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230539"
+editedAt: null
+createdAt: DateTimeImmutable @1703471560 {#5331
date: 2023-12-25 03:32:40.0 +01:00
}
} |
|
Show voter details
|
| 99 |
DENIED
|
edit
|
App\Entity\EntryComment {#5332
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4685
+user: App\Entity\User {#4698 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
I think the most impressive part of this is that your wife cares.\n
\n
...does she have a sister?
"""
+lang: "en"
+isAdult: false
+favouriteCount: 5
+score: 0
+lastActive: DateTime @1707607495 {#4680
date: 2024-02-11 00:24:55.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4686 …}
+nested: Doctrine\ORM\PersistentCollection {#4688 …}
+votes: Doctrine\ORM\PersistentCollection {#4690 …}
+reports: Doctrine\ORM\PersistentCollection {#4692 …}
+favourites: Doctrine\ORM\PersistentCollection {#4694 …}
+notifications: Doctrine\ORM\PersistentCollection {#4696 …}
-id: 249792
-bodyTs: "'care':13 'impress':5 'part':6 'sister':18 'think':2 'wife':12"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://kbin.social/m/linux@lemmy.ml/t/723399/-/comment/4292558"
+editedAt: null
+createdAt: DateTimeImmutable @1703459627 {#4681
date: 2023-12-25 00:13:47.0 +01:00
}
}
+root: App\Entity\EntryComment {#4685}
+body: "She does but, I’d stay away from the sister. 🤣"
+lang: "en"
+isAdult: false
+favouriteCount: 0
+score: 0
+lastActive: DateTime @1703471560 {#5330
date: 2023-12-25 03:32:40.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@prowess2956@kbin.social"
]
+children: Doctrine\ORM\PersistentCollection {#5333 …}
+nested: Doctrine\ORM\PersistentCollection {#5335 …}
+votes: Doctrine\ORM\PersistentCollection {#5337 …}
+reports: Doctrine\ORM\PersistentCollection {#5339 …}
+favourites: Doctrine\ORM\PersistentCollection {#5341 …}
+notifications: Doctrine\ORM\PersistentCollection {#5343 …}
-id: 250127
-bodyTs: "'away':7 'd':5 'sister':10 'stay':6"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230539"
+editedAt: null
+createdAt: DateTimeImmutable @1703471560 {#5331
date: 2023-12-25 03:32:40.0 +01:00
}
} |
|
Show voter details
|
| 100 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5332
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4685
+user: App\Entity\User {#4698 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
I think the most impressive part of this is that your wife cares.\n
\n
...does she have a sister?
"""
+lang: "en"
+isAdult: false
+favouriteCount: 5
+score: 0
+lastActive: DateTime @1707607495 {#4680
date: 2024-02-11 00:24:55.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4686 …}
+nested: Doctrine\ORM\PersistentCollection {#4688 …}
+votes: Doctrine\ORM\PersistentCollection {#4690 …}
+reports: Doctrine\ORM\PersistentCollection {#4692 …}
+favourites: Doctrine\ORM\PersistentCollection {#4694 …}
+notifications: Doctrine\ORM\PersistentCollection {#4696 …}
-id: 249792
-bodyTs: "'care':13 'impress':5 'part':6 'sister':18 'think':2 'wife':12"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://kbin.social/m/linux@lemmy.ml/t/723399/-/comment/4292558"
+editedAt: null
+createdAt: DateTimeImmutable @1703459627 {#4681
date: 2023-12-25 00:13:47.0 +01:00
}
}
+root: App\Entity\EntryComment {#4685}
+body: "She does but, I’d stay away from the sister. 🤣"
+lang: "en"
+isAdult: false
+favouriteCount: 0
+score: 0
+lastActive: DateTime @1703471560 {#5330
date: 2023-12-25 03:32:40.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@prowess2956@kbin.social"
]
+children: Doctrine\ORM\PersistentCollection {#5333 …}
+nested: Doctrine\ORM\PersistentCollection {#5335 …}
+votes: Doctrine\ORM\PersistentCollection {#5337 …}
+reports: Doctrine\ORM\PersistentCollection {#5339 …}
+favourites: Doctrine\ORM\PersistentCollection {#5341 …}
+notifications: Doctrine\ORM\PersistentCollection {#5343 …}
-id: 250127
-bodyTs: "'away':7 'd':5 'sister':10 'stay':6"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230539"
+editedAt: null
+createdAt: DateTimeImmutable @1703471560 {#5331
date: 2023-12-25 03:32:40.0 +01:00
}
} |
|
Show voter details
|
| 101 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 102 |
DENIED
|
moderate
|
App\Entity\EntryComment {#4759
+user: App\Entity\User {#4772 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "> Give a man a regular expression and he’ll match a string… teach him to make his own regular expressions and you’ve got a man with problems. – yakugo in [regex.info/blog/2006-09-15/247#comment-3022](http://regex.info/blog/2006-09-15/247#comment-3022) (and yes, it is `http://` never `https://` for this domain)"
+lang: "en"
+isAdult: false
+favouriteCount: 4
+score: 0
+lastActive: DateTime @1707608447 {#4753
date: 2024-02-11 00:40:47.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4760 …}
+nested: Doctrine\ORM\PersistentCollection {#4762 …}
+votes: Doctrine\ORM\PersistentCollection {#4764 …}
+reports: Doctrine\ORM\PersistentCollection {#4766 …}
+favourites: Doctrine\ORM\PersistentCollection {#4768 …}
+notifications: Doctrine\ORM\PersistentCollection {#4770 …}
-id: 249765
-bodyTs: "'/blog/2006-09-15/247#comment-3022](http://regex.info/blog/2006-09-15/247#comment-3022)':33 'domain':41 'express':6,20 'give':1 'got':24 'll':9 'make':16 'man':3,26 'match':10 'never':38 'problem':28 'regex.info':32 'regex.info/blog/2006-09-15/247#comment-3022](http://regex.info/blog/2006-09-15/247#comment-3022)':31 'regular':5,19 'string':12 'teach':13 've':23 'yakugo':29 'yes':35"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6228418"
+editedAt: DateTimeImmutable @1707579961 {#4754
date: 2024-02-10 16:46:01.0 +01:00
}
+createdAt: DateTimeImmutable @1703459335 {#4755
date: 2023-12-25 00:08:55.0 +01:00
}
} |
|
Show voter details
|
| 103 |
DENIED
|
edit
|
App\Entity\EntryComment {#4759
+user: App\Entity\User {#4772 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "> Give a man a regular expression and he’ll match a string… teach him to make his own regular expressions and you’ve got a man with problems. – yakugo in [regex.info/blog/2006-09-15/247#comment-3022](http://regex.info/blog/2006-09-15/247#comment-3022) (and yes, it is `http://` never `https://` for this domain)"
+lang: "en"
+isAdult: false
+favouriteCount: 4
+score: 0
+lastActive: DateTime @1707608447 {#4753
date: 2024-02-11 00:40:47.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4760 …}
+nested: Doctrine\ORM\PersistentCollection {#4762 …}
+votes: Doctrine\ORM\PersistentCollection {#4764 …}
+reports: Doctrine\ORM\PersistentCollection {#4766 …}
+favourites: Doctrine\ORM\PersistentCollection {#4768 …}
+notifications: Doctrine\ORM\PersistentCollection {#4770 …}
-id: 249765
-bodyTs: "'/blog/2006-09-15/247#comment-3022](http://regex.info/blog/2006-09-15/247#comment-3022)':33 'domain':41 'express':6,20 'give':1 'got':24 'll':9 'make':16 'man':3,26 'match':10 'never':38 'problem':28 'regex.info':32 'regex.info/blog/2006-09-15/247#comment-3022](http://regex.info/blog/2006-09-15/247#comment-3022)':31 'regular':5,19 'string':12 'teach':13 've':23 'yakugo':29 'yes':35"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6228418"
+editedAt: DateTimeImmutable @1707579961 {#4754
date: 2024-02-10 16:46:01.0 +01:00
}
+createdAt: DateTimeImmutable @1703459335 {#4755
date: 2023-12-25 00:08:55.0 +01:00
}
} |
|
Show voter details
|
| 104 |
DENIED
|
moderate
|
App\Entity\EntryComment {#4759
+user: App\Entity\User {#4772 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "> Give a man a regular expression and he’ll match a string… teach him to make his own regular expressions and you’ve got a man with problems. – yakugo in [regex.info/blog/2006-09-15/247#comment-3022](http://regex.info/blog/2006-09-15/247#comment-3022) (and yes, it is `http://` never `https://` for this domain)"
+lang: "en"
+isAdult: false
+favouriteCount: 4
+score: 0
+lastActive: DateTime @1707608447 {#4753
date: 2024-02-11 00:40:47.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4760 …}
+nested: Doctrine\ORM\PersistentCollection {#4762 …}
+votes: Doctrine\ORM\PersistentCollection {#4764 …}
+reports: Doctrine\ORM\PersistentCollection {#4766 …}
+favourites: Doctrine\ORM\PersistentCollection {#4768 …}
+notifications: Doctrine\ORM\PersistentCollection {#4770 …}
-id: 249765
-bodyTs: "'/blog/2006-09-15/247#comment-3022](http://regex.info/blog/2006-09-15/247#comment-3022)':33 'domain':41 'express':6,20 'give':1 'got':24 'll':9 'make':16 'man':3,26 'match':10 'never':38 'problem':28 'regex.info':32 'regex.info/blog/2006-09-15/247#comment-3022](http://regex.info/blog/2006-09-15/247#comment-3022)':31 'regular':5,19 'string':12 'teach':13 've':23 'yakugo':29 'yes':35"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6228418"
+editedAt: DateTimeImmutable @1707579961 {#4754
date: 2024-02-10 16:46:01.0 +01:00
}
+createdAt: DateTimeImmutable @1703459335 {#4755
date: 2023-12-25 00:08:55.0 +01:00
}
} |
|
Show voter details
|
| 105 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 106 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5286
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4759
+user: App\Entity\User {#4772 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "> Give a man a regular expression and he’ll match a string… teach him to make his own regular expressions and you’ve got a man with problems. – yakugo in [regex.info/blog/2006-09-15/247#comment-3022](http://regex.info/blog/2006-09-15/247#comment-3022) (and yes, it is `http://` never `https://` for this domain)"
+lang: "en"
+isAdult: false
+favouriteCount: 4
+score: 0
+lastActive: DateTime @1707608447 {#4753
date: 2024-02-11 00:40:47.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4760 …}
+nested: Doctrine\ORM\PersistentCollection {#4762 …}
+votes: Doctrine\ORM\PersistentCollection {#4764 …}
+reports: Doctrine\ORM\PersistentCollection {#4766 …}
+favourites: Doctrine\ORM\PersistentCollection {#4768 …}
+notifications: Doctrine\ORM\PersistentCollection {#4770 …}
-id: 249765
-bodyTs: "'/blog/2006-09-15/247#comment-3022](http://regex.info/blog/2006-09-15/247#comment-3022)':33 'domain':41 'express':6,20 'give':1 'got':24 'll':9 'make':16 'man':3,26 'match':10 'never':38 'problem':28 'regex.info':32 'regex.info/blog/2006-09-15/247#comment-3022](http://regex.info/blog/2006-09-15/247#comment-3022)':31 'regular':5,19 'string':12 'teach':13 've':23 'yakugo':29 'yes':35"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6228418"
+editedAt: DateTimeImmutable @1707579961 {#4754
date: 2024-02-10 16:46:01.0 +01:00
}
+createdAt: DateTimeImmutable @1703459335 {#4755
date: 2023-12-25 00:08:55.0 +01:00
}
}
+root: App\Entity\EntryComment {#4759}
+body: "Guess I’ve got problems!"
+lang: "en"
+isAdult: false
+favouriteCount: 0
+score: 0
+lastActive: DateTime @1703471996 {#5284
date: 2023-12-25 03:39:56.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@mcepl@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5287 …}
+nested: Doctrine\ORM\PersistentCollection {#5289 …}
+votes: Doctrine\ORM\PersistentCollection {#5291 …}
+reports: Doctrine\ORM\PersistentCollection {#5293 …}
+favourites: Doctrine\ORM\PersistentCollection {#5295 …}
+notifications: Doctrine\ORM\PersistentCollection {#5297 …}
-id: 250145
-bodyTs: "'got':4 'guess':1 'problem':5 've':3"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230619"
+editedAt: null
+createdAt: DateTimeImmutable @1703471996 {#5285
date: 2023-12-25 03:39:56.0 +01:00
}
} |
|
Show voter details
|
| 107 |
DENIED
|
edit
|
App\Entity\EntryComment {#5286
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4759
+user: App\Entity\User {#4772 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "> Give a man a regular expression and he’ll match a string… teach him to make his own regular expressions and you’ve got a man with problems. – yakugo in [regex.info/blog/2006-09-15/247#comment-3022](http://regex.info/blog/2006-09-15/247#comment-3022) (and yes, it is `http://` never `https://` for this domain)"
+lang: "en"
+isAdult: false
+favouriteCount: 4
+score: 0
+lastActive: DateTime @1707608447 {#4753
date: 2024-02-11 00:40:47.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4760 …}
+nested: Doctrine\ORM\PersistentCollection {#4762 …}
+votes: Doctrine\ORM\PersistentCollection {#4764 …}
+reports: Doctrine\ORM\PersistentCollection {#4766 …}
+favourites: Doctrine\ORM\PersistentCollection {#4768 …}
+notifications: Doctrine\ORM\PersistentCollection {#4770 …}
-id: 249765
-bodyTs: "'/blog/2006-09-15/247#comment-3022](http://regex.info/blog/2006-09-15/247#comment-3022)':33 'domain':41 'express':6,20 'give':1 'got':24 'll':9 'make':16 'man':3,26 'match':10 'never':38 'problem':28 'regex.info':32 'regex.info/blog/2006-09-15/247#comment-3022](http://regex.info/blog/2006-09-15/247#comment-3022)':31 'regular':5,19 'string':12 'teach':13 've':23 'yakugo':29 'yes':35"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6228418"
+editedAt: DateTimeImmutable @1707579961 {#4754
date: 2024-02-10 16:46:01.0 +01:00
}
+createdAt: DateTimeImmutable @1703459335 {#4755
date: 2023-12-25 00:08:55.0 +01:00
}
}
+root: App\Entity\EntryComment {#4759}
+body: "Guess I’ve got problems!"
+lang: "en"
+isAdult: false
+favouriteCount: 0
+score: 0
+lastActive: DateTime @1703471996 {#5284
date: 2023-12-25 03:39:56.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@mcepl@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5287 …}
+nested: Doctrine\ORM\PersistentCollection {#5289 …}
+votes: Doctrine\ORM\PersistentCollection {#5291 …}
+reports: Doctrine\ORM\PersistentCollection {#5293 …}
+favourites: Doctrine\ORM\PersistentCollection {#5295 …}
+notifications: Doctrine\ORM\PersistentCollection {#5297 …}
-id: 250145
-bodyTs: "'got':4 'guess':1 'problem':5 've':3"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230619"
+editedAt: null
+createdAt: DateTimeImmutable @1703471996 {#5285
date: 2023-12-25 03:39:56.0 +01:00
}
} |
|
Show voter details
|
| 108 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5286
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4759
+user: App\Entity\User {#4772 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "> Give a man a regular expression and he’ll match a string… teach him to make his own regular expressions and you’ve got a man with problems. – yakugo in [regex.info/blog/2006-09-15/247#comment-3022](http://regex.info/blog/2006-09-15/247#comment-3022) (and yes, it is `http://` never `https://` for this domain)"
+lang: "en"
+isAdult: false
+favouriteCount: 4
+score: 0
+lastActive: DateTime @1707608447 {#4753
date: 2024-02-11 00:40:47.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4760 …}
+nested: Doctrine\ORM\PersistentCollection {#4762 …}
+votes: Doctrine\ORM\PersistentCollection {#4764 …}
+reports: Doctrine\ORM\PersistentCollection {#4766 …}
+favourites: Doctrine\ORM\PersistentCollection {#4768 …}
+notifications: Doctrine\ORM\PersistentCollection {#4770 …}
-id: 249765
-bodyTs: "'/blog/2006-09-15/247#comment-3022](http://regex.info/blog/2006-09-15/247#comment-3022)':33 'domain':41 'express':6,20 'give':1 'got':24 'll':9 'make':16 'man':3,26 'match':10 'never':38 'problem':28 'regex.info':32 'regex.info/blog/2006-09-15/247#comment-3022](http://regex.info/blog/2006-09-15/247#comment-3022)':31 'regular':5,19 'string':12 'teach':13 've':23 'yakugo':29 'yes':35"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6228418"
+editedAt: DateTimeImmutable @1707579961 {#4754
date: 2024-02-10 16:46:01.0 +01:00
}
+createdAt: DateTimeImmutable @1703459335 {#4755
date: 2023-12-25 00:08:55.0 +01:00
}
}
+root: App\Entity\EntryComment {#4759}
+body: "Guess I’ve got problems!"
+lang: "en"
+isAdult: false
+favouriteCount: 0
+score: 0
+lastActive: DateTime @1703471996 {#5284
date: 2023-12-25 03:39:56.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@mcepl@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5287 …}
+nested: Doctrine\ORM\PersistentCollection {#5289 …}
+votes: Doctrine\ORM\PersistentCollection {#5291 …}
+reports: Doctrine\ORM\PersistentCollection {#5293 …}
+favourites: Doctrine\ORM\PersistentCollection {#5295 …}
+notifications: Doctrine\ORM\PersistentCollection {#5297 …}
-id: 250145
-bodyTs: "'got':4 'guess':1 'problem':5 've':3"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230619"
+editedAt: null
+createdAt: DateTimeImmutable @1703471996 {#5285
date: 2023-12-25 03:39:56.0 +01:00
}
} |
|
Show voter details
|
| 109 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 110 |
DENIED
|
moderate
|
App\Entity\EntryComment {#4833
+user: App\Entity\User {#4846 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "Regexps are awesome! And also not at the same time:-P. 🎉 Congrats👏!:-)"
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1707608918 {#4828
date: 2024-02-11 00:48:38.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4834 …}
+nested: Doctrine\ORM\PersistentCollection {#4836 …}
+votes: Doctrine\ORM\PersistentCollection {#4838 …}
+reports: Doctrine\ORM\PersistentCollection {#4840 …}
+favourites: Doctrine\ORM\PersistentCollection {#4842 …}
+notifications: Doctrine\ORM\PersistentCollection {#4844 …}
-id: 249774
-bodyTs: "'also':5 'awesom':3 'congrat':12 'p':11 'regexp':1 'time':10"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://kbin.social/m/linux@lemmy.ml/t/723399/-/comment/4292485"
+editedAt: null
+createdAt: DateTimeImmutable @1703459248 {#4829
date: 2023-12-25 00:07:28.0 +01:00
}
} |
|
Show voter details
|
| 111 |
DENIED
|
edit
|
App\Entity\EntryComment {#4833
+user: App\Entity\User {#4846 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "Regexps are awesome! And also not at the same time:-P. 🎉 Congrats👏!:-)"
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1707608918 {#4828
date: 2024-02-11 00:48:38.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4834 …}
+nested: Doctrine\ORM\PersistentCollection {#4836 …}
+votes: Doctrine\ORM\PersistentCollection {#4838 …}
+reports: Doctrine\ORM\PersistentCollection {#4840 …}
+favourites: Doctrine\ORM\PersistentCollection {#4842 …}
+notifications: Doctrine\ORM\PersistentCollection {#4844 …}
-id: 249774
-bodyTs: "'also':5 'awesom':3 'congrat':12 'p':11 'regexp':1 'time':10"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://kbin.social/m/linux@lemmy.ml/t/723399/-/comment/4292485"
+editedAt: null
+createdAt: DateTimeImmutable @1703459248 {#4829
date: 2023-12-25 00:07:28.0 +01:00
}
} |
|
Show voter details
|
| 112 |
DENIED
|
moderate
|
App\Entity\EntryComment {#4833
+user: App\Entity\User {#4846 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "Regexps are awesome! And also not at the same time:-P. 🎉 Congrats👏!:-)"
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1707608918 {#4828
date: 2024-02-11 00:48:38.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4834 …}
+nested: Doctrine\ORM\PersistentCollection {#4836 …}
+votes: Doctrine\ORM\PersistentCollection {#4838 …}
+reports: Doctrine\ORM\PersistentCollection {#4840 …}
+favourites: Doctrine\ORM\PersistentCollection {#4842 …}
+notifications: Doctrine\ORM\PersistentCollection {#4844 …}
-id: 249774
-bodyTs: "'also':5 'awesom':3 'congrat':12 'p':11 'regexp':1 'time':10"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://kbin.social/m/linux@lemmy.ml/t/723399/-/comment/4292485"
+editedAt: null
+createdAt: DateTimeImmutable @1703459248 {#4829
date: 2023-12-25 00:07:28.0 +01:00
}
} |
|
Show voter details
|
| 113 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 114 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5301
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4833
+user: App\Entity\User {#4846 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "Regexps are awesome! And also not at the same time:-P. 🎉 Congrats👏!:-)"
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1707608918 {#4828
date: 2024-02-11 00:48:38.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4834 …}
+nested: Doctrine\ORM\PersistentCollection {#4836 …}
+votes: Doctrine\ORM\PersistentCollection {#4838 …}
+reports: Doctrine\ORM\PersistentCollection {#4840 …}
+favourites: Doctrine\ORM\PersistentCollection {#4842 …}
+notifications: Doctrine\ORM\PersistentCollection {#4844 …}
-id: 249774
-bodyTs: "'also':5 'awesom':3 'congrat':12 'p':11 'regexp':1 'time':10"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://kbin.social/m/linux@lemmy.ml/t/723399/-/comment/4292485"
+editedAt: null
+createdAt: DateTimeImmutable @1703459248 {#4829
date: 2023-12-25 00:07:28.0 +01:00
}
}
+root: App\Entity\EntryComment {#4833}
+body: "Thank you!"
+lang: "en"
+isAdult: false
+favouriteCount: 0
+score: 0
+lastActive: DateTime @1703472178 {#5299
date: 2023-12-25 03:42:58.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@OpenStars@kbin.social"
]
+children: Doctrine\ORM\PersistentCollection {#5302 …}
+nested: Doctrine\ORM\PersistentCollection {#5304 …}
+votes: Doctrine\ORM\PersistentCollection {#5306 …}
+reports: Doctrine\ORM\PersistentCollection {#5308 …}
+favourites: Doctrine\ORM\PersistentCollection {#5310 …}
+notifications: Doctrine\ORM\PersistentCollection {#5312 …}
-id: 250153
-bodyTs: "'thank':1"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230653"
+editedAt: null
+createdAt: DateTimeImmutable @1703472178 {#5300
date: 2023-12-25 03:42:58.0 +01:00
}
} |
|
Show voter details
|
| 115 |
DENIED
|
edit
|
App\Entity\EntryComment {#5301
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4833
+user: App\Entity\User {#4846 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "Regexps are awesome! And also not at the same time:-P. 🎉 Congrats👏!:-)"
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1707608918 {#4828
date: 2024-02-11 00:48:38.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4834 …}
+nested: Doctrine\ORM\PersistentCollection {#4836 …}
+votes: Doctrine\ORM\PersistentCollection {#4838 …}
+reports: Doctrine\ORM\PersistentCollection {#4840 …}
+favourites: Doctrine\ORM\PersistentCollection {#4842 …}
+notifications: Doctrine\ORM\PersistentCollection {#4844 …}
-id: 249774
-bodyTs: "'also':5 'awesom':3 'congrat':12 'p':11 'regexp':1 'time':10"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://kbin.social/m/linux@lemmy.ml/t/723399/-/comment/4292485"
+editedAt: null
+createdAt: DateTimeImmutable @1703459248 {#4829
date: 2023-12-25 00:07:28.0 +01:00
}
}
+root: App\Entity\EntryComment {#4833}
+body: "Thank you!"
+lang: "en"
+isAdult: false
+favouriteCount: 0
+score: 0
+lastActive: DateTime @1703472178 {#5299
date: 2023-12-25 03:42:58.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@OpenStars@kbin.social"
]
+children: Doctrine\ORM\PersistentCollection {#5302 …}
+nested: Doctrine\ORM\PersistentCollection {#5304 …}
+votes: Doctrine\ORM\PersistentCollection {#5306 …}
+reports: Doctrine\ORM\PersistentCollection {#5308 …}
+favourites: Doctrine\ORM\PersistentCollection {#5310 …}
+notifications: Doctrine\ORM\PersistentCollection {#5312 …}
-id: 250153
-bodyTs: "'thank':1"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230653"
+editedAt: null
+createdAt: DateTimeImmutable @1703472178 {#5300
date: 2023-12-25 03:42:58.0 +01:00
}
} |
|
Show voter details
|
| 116 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5301
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4833
+user: App\Entity\User {#4846 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "Regexps are awesome! And also not at the same time:-P. 🎉 Congrats👏!:-)"
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1707608918 {#4828
date: 2024-02-11 00:48:38.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4834 …}
+nested: Doctrine\ORM\PersistentCollection {#4836 …}
+votes: Doctrine\ORM\PersistentCollection {#4838 …}
+reports: Doctrine\ORM\PersistentCollection {#4840 …}
+favourites: Doctrine\ORM\PersistentCollection {#4842 …}
+notifications: Doctrine\ORM\PersistentCollection {#4844 …}
-id: 249774
-bodyTs: "'also':5 'awesom':3 'congrat':12 'p':11 'regexp':1 'time':10"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://kbin.social/m/linux@lemmy.ml/t/723399/-/comment/4292485"
+editedAt: null
+createdAt: DateTimeImmutable @1703459248 {#4829
date: 2023-12-25 00:07:28.0 +01:00
}
}
+root: App\Entity\EntryComment {#4833}
+body: "Thank you!"
+lang: "en"
+isAdult: false
+favouriteCount: 0
+score: 0
+lastActive: DateTime @1703472178 {#5299
date: 2023-12-25 03:42:58.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@OpenStars@kbin.social"
]
+children: Doctrine\ORM\PersistentCollection {#5302 …}
+nested: Doctrine\ORM\PersistentCollection {#5304 …}
+votes: Doctrine\ORM\PersistentCollection {#5306 …}
+reports: Doctrine\ORM\PersistentCollection {#5308 …}
+favourites: Doctrine\ORM\PersistentCollection {#5310 …}
+notifications: Doctrine\ORM\PersistentCollection {#5312 …}
-id: 250153
-bodyTs: "'thank':1"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230653"
+editedAt: null
+createdAt: DateTimeImmutable @1703472178 {#5300
date: 2023-12-25 03:42:58.0 +01:00
}
} |
|
Show voter details
|
| 117 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 118 |
DENIED
|
moderate
|
App\Entity\EntryComment {#4907
+user: App\Entity\User {#4920 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "“regex” means “regular expression”, so “regex expression” means “regular expression expression”."
+lang: "en"
+isAdult: false
+favouriteCount: 8
+score: 0
+lastActive: DateTime @1707607195 {#4902
date: 2024-02-11 00:19:55.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4908 …}
+nested: Doctrine\ORM\PersistentCollection {#4910 …}
+votes: Doctrine\ORM\PersistentCollection {#4912 …}
+reports: Doctrine\ORM\PersistentCollection {#4914 …}
+favourites: Doctrine\ORM\PersistentCollection {#4916 …}
+notifications: Doctrine\ORM\PersistentCollection {#4918 …}
-id: 249758
-bodyTs: "'express':4,7,10,11 'mean':2,8 'regex':1,6 'regular':3,9"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6864356"
+editedAt: null
+createdAt: DateTimeImmutable @1703459126 {#4903
date: 2023-12-25 00:05:26.0 +01:00
}
} |
|
Show voter details
|
| 119 |
DENIED
|
edit
|
App\Entity\EntryComment {#4907
+user: App\Entity\User {#4920 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "“regex” means “regular expression”, so “regex expression” means “regular expression expression”."
+lang: "en"
+isAdult: false
+favouriteCount: 8
+score: 0
+lastActive: DateTime @1707607195 {#4902
date: 2024-02-11 00:19:55.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4908 …}
+nested: Doctrine\ORM\PersistentCollection {#4910 …}
+votes: Doctrine\ORM\PersistentCollection {#4912 …}
+reports: Doctrine\ORM\PersistentCollection {#4914 …}
+favourites: Doctrine\ORM\PersistentCollection {#4916 …}
+notifications: Doctrine\ORM\PersistentCollection {#4918 …}
-id: 249758
-bodyTs: "'express':4,7,10,11 'mean':2,8 'regex':1,6 'regular':3,9"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6864356"
+editedAt: null
+createdAt: DateTimeImmutable @1703459126 {#4903
date: 2023-12-25 00:05:26.0 +01:00
}
} |
|
Show voter details
|
| 120 |
DENIED
|
moderate
|
App\Entity\EntryComment {#4907
+user: App\Entity\User {#4920 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "“regex” means “regular expression”, so “regex expression” means “regular expression expression”."
+lang: "en"
+isAdult: false
+favouriteCount: 8
+score: 0
+lastActive: DateTime @1707607195 {#4902
date: 2024-02-11 00:19:55.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4908 …}
+nested: Doctrine\ORM\PersistentCollection {#4910 …}
+votes: Doctrine\ORM\PersistentCollection {#4912 …}
+reports: Doctrine\ORM\PersistentCollection {#4914 …}
+favourites: Doctrine\ORM\PersistentCollection {#4916 …}
+notifications: Doctrine\ORM\PersistentCollection {#4918 …}
-id: 249758
-bodyTs: "'express':4,7,10,11 'mean':2,8 'regex':1,6 'regular':3,9"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6864356"
+editedAt: null
+createdAt: DateTimeImmutable @1703459126 {#4903
date: 2023-12-25 00:05:26.0 +01:00
}
} |
|
Show voter details
|
| 121 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 122 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5271
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4907
+user: App\Entity\User {#4920 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "“regex” means “regular expression”, so “regex expression” means “regular expression expression”."
+lang: "en"
+isAdult: false
+favouriteCount: 8
+score: 0
+lastActive: DateTime @1707607195 {#4902
date: 2024-02-11 00:19:55.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4908 …}
+nested: Doctrine\ORM\PersistentCollection {#4910 …}
+votes: Doctrine\ORM\PersistentCollection {#4912 …}
+reports: Doctrine\ORM\PersistentCollection {#4914 …}
+favourites: Doctrine\ORM\PersistentCollection {#4916 …}
+notifications: Doctrine\ORM\PersistentCollection {#4918 …}
-id: 249758
-bodyTs: "'express':4,7,10,11 'mean':2,8 'regex':1,6 'regular':3,9"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6864356"
+editedAt: null
+createdAt: DateTimeImmutable @1703459126 {#4903
date: 2023-12-25 00:05:26.0 +01:00
}
}
+root: App\Entity\EntryComment {#4907}
+body: "Dang! I read through my post three times to make sure I didn’t do that and completely missed that I did it right in the title. (Now fixed)."
+lang: "en"
+isAdult: false
+favouriteCount: 2
+score: 0
+lastActive: DateTime @1703471441 {#5269
date: 2023-12-25 03:30:41.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@davel@lemmy.ml"
]
+children: Doctrine\ORM\PersistentCollection {#5272 …}
+nested: Doctrine\ORM\PersistentCollection {#5274 …}
+votes: Doctrine\ORM\PersistentCollection {#5276 …}
+reports: Doctrine\ORM\PersistentCollection {#5278 …}
+favourites: Doctrine\ORM\PersistentCollection {#5280 …}
+notifications: Doctrine\ORM\PersistentCollection {#5282 …}
-id: 250123
-bodyTs: "'complet':18 'dang':1 'didn':13 'fix':29 'make':10 'miss':19 'post':6 'read':3 'right':24 'sure':11 'three':7 'time':8 'titl':27"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230521"
+editedAt: null
+createdAt: DateTimeImmutable @1703471441 {#5270
date: 2023-12-25 03:30:41.0 +01:00
}
} |
|
Show voter details
|
| 123 |
DENIED
|
edit
|
App\Entity\EntryComment {#5271
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4907
+user: App\Entity\User {#4920 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "“regex” means “regular expression”, so “regex expression” means “regular expression expression”."
+lang: "en"
+isAdult: false
+favouriteCount: 8
+score: 0
+lastActive: DateTime @1707607195 {#4902
date: 2024-02-11 00:19:55.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4908 …}
+nested: Doctrine\ORM\PersistentCollection {#4910 …}
+votes: Doctrine\ORM\PersistentCollection {#4912 …}
+reports: Doctrine\ORM\PersistentCollection {#4914 …}
+favourites: Doctrine\ORM\PersistentCollection {#4916 …}
+notifications: Doctrine\ORM\PersistentCollection {#4918 …}
-id: 249758
-bodyTs: "'express':4,7,10,11 'mean':2,8 'regex':1,6 'regular':3,9"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6864356"
+editedAt: null
+createdAt: DateTimeImmutable @1703459126 {#4903
date: 2023-12-25 00:05:26.0 +01:00
}
}
+root: App\Entity\EntryComment {#4907}
+body: "Dang! I read through my post three times to make sure I didn’t do that and completely missed that I did it right in the title. (Now fixed)."
+lang: "en"
+isAdult: false
+favouriteCount: 2
+score: 0
+lastActive: DateTime @1703471441 {#5269
date: 2023-12-25 03:30:41.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@davel@lemmy.ml"
]
+children: Doctrine\ORM\PersistentCollection {#5272 …}
+nested: Doctrine\ORM\PersistentCollection {#5274 …}
+votes: Doctrine\ORM\PersistentCollection {#5276 …}
+reports: Doctrine\ORM\PersistentCollection {#5278 …}
+favourites: Doctrine\ORM\PersistentCollection {#5280 …}
+notifications: Doctrine\ORM\PersistentCollection {#5282 …}
-id: 250123
-bodyTs: "'complet':18 'dang':1 'didn':13 'fix':29 'make':10 'miss':19 'post':6 'read':3 'right':24 'sure':11 'three':7 'time':8 'titl':27"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230521"
+editedAt: null
+createdAt: DateTimeImmutable @1703471441 {#5270
date: 2023-12-25 03:30:41.0 +01:00
}
} |
|
Show voter details
|
| 124 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5271
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4907
+user: App\Entity\User {#4920 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "“regex” means “regular expression”, so “regex expression” means “regular expression expression”."
+lang: "en"
+isAdult: false
+favouriteCount: 8
+score: 0
+lastActive: DateTime @1707607195 {#4902
date: 2024-02-11 00:19:55.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4908 …}
+nested: Doctrine\ORM\PersistentCollection {#4910 …}
+votes: Doctrine\ORM\PersistentCollection {#4912 …}
+reports: Doctrine\ORM\PersistentCollection {#4914 …}
+favourites: Doctrine\ORM\PersistentCollection {#4916 …}
+notifications: Doctrine\ORM\PersistentCollection {#4918 …}
-id: 249758
-bodyTs: "'express':4,7,10,11 'mean':2,8 'regex':1,6 'regular':3,9"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/6864356"
+editedAt: null
+createdAt: DateTimeImmutable @1703459126 {#4903
date: 2023-12-25 00:05:26.0 +01:00
}
}
+root: App\Entity\EntryComment {#4907}
+body: "Dang! I read through my post three times to make sure I didn’t do that and completely missed that I did it right in the title. (Now fixed)."
+lang: "en"
+isAdult: false
+favouriteCount: 2
+score: 0
+lastActive: DateTime @1703471441 {#5269
date: 2023-12-25 03:30:41.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@davel@lemmy.ml"
]
+children: Doctrine\ORM\PersistentCollection {#5272 …}
+nested: Doctrine\ORM\PersistentCollection {#5274 …}
+votes: Doctrine\ORM\PersistentCollection {#5276 …}
+reports: Doctrine\ORM\PersistentCollection {#5278 …}
+favourites: Doctrine\ORM\PersistentCollection {#5280 …}
+notifications: Doctrine\ORM\PersistentCollection {#5282 …}
-id: 250123
-bodyTs: "'complet':18 'dang':1 'didn':13 'fix':29 'make':10 'miss':19 'post':6 'read':3 'right':24 'sure':11 'three':7 'time':8 'titl':27"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230521"
+editedAt: null
+createdAt: DateTimeImmutable @1703471441 {#5270
date: 2023-12-25 03:30:41.0 +01:00
}
} |
|
Show voter details
|
| 125 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 126 |
DENIED
|
moderate
|
App\Entity\EntryComment {#4981
+user: App\Entity\User {#4994 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "I highly recommend [alf.nu/RegexGolf?world=regex&level=r00](https://alf.nu/RegexGolf?world=regex&level=r00)"
+lang: "en"
+isAdult: false
+favouriteCount: 4
+score: 0
+lastActive: DateTime @1707640644 {#4976
date: 2024-02-11 09:37:24.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4982 …}
+nested: Doctrine\ORM\PersistentCollection {#4984 …}
+votes: Doctrine\ORM\PersistentCollection {#4986 …}
+reports: Doctrine\ORM\PersistentCollection {#4988 …}
+favourites: Doctrine\ORM\PersistentCollection {#4990 …}
+notifications: Doctrine\ORM\PersistentCollection {#4992 …}
-id: 249710
-bodyTs: "'/regexgolf?world=regex&level=r00](https://alf.nu/regexgolf?world=regex&level=r00)':6 'alf.nu':5 'alf.nu/regexgolf?world=regex&level=r00](https://alf.nu/regexgolf?world=regex&level=r00)':4 'high':2 'recommend':3"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ca/comment/5870032"
+editedAt: null
+createdAt: DateTimeImmutable @1703458182 {#4977
date: 2023-12-24 23:49:42.0 +01:00
}
} |
|
Show voter details
|
| 127 |
DENIED
|
edit
|
App\Entity\EntryComment {#4981
+user: App\Entity\User {#4994 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "I highly recommend [alf.nu/RegexGolf?world=regex&level=r00](https://alf.nu/RegexGolf?world=regex&level=r00)"
+lang: "en"
+isAdult: false
+favouriteCount: 4
+score: 0
+lastActive: DateTime @1707640644 {#4976
date: 2024-02-11 09:37:24.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4982 …}
+nested: Doctrine\ORM\PersistentCollection {#4984 …}
+votes: Doctrine\ORM\PersistentCollection {#4986 …}
+reports: Doctrine\ORM\PersistentCollection {#4988 …}
+favourites: Doctrine\ORM\PersistentCollection {#4990 …}
+notifications: Doctrine\ORM\PersistentCollection {#4992 …}
-id: 249710
-bodyTs: "'/regexgolf?world=regex&level=r00](https://alf.nu/regexgolf?world=regex&level=r00)':6 'alf.nu':5 'alf.nu/regexgolf?world=regex&level=r00](https://alf.nu/regexgolf?world=regex&level=r00)':4 'high':2 'recommend':3"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ca/comment/5870032"
+editedAt: null
+createdAt: DateTimeImmutable @1703458182 {#4977
date: 2023-12-24 23:49:42.0 +01:00
}
} |
|
Show voter details
|
| 128 |
DENIED
|
moderate
|
App\Entity\EntryComment {#4981
+user: App\Entity\User {#4994 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "I highly recommend [alf.nu/RegexGolf?world=regex&level=r00](https://alf.nu/RegexGolf?world=regex&level=r00)"
+lang: "en"
+isAdult: false
+favouriteCount: 4
+score: 0
+lastActive: DateTime @1707640644 {#4976
date: 2024-02-11 09:37:24.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4982 …}
+nested: Doctrine\ORM\PersistentCollection {#4984 …}
+votes: Doctrine\ORM\PersistentCollection {#4986 …}
+reports: Doctrine\ORM\PersistentCollection {#4988 …}
+favourites: Doctrine\ORM\PersistentCollection {#4990 …}
+notifications: Doctrine\ORM\PersistentCollection {#4992 …}
-id: 249710
-bodyTs: "'/regexgolf?world=regex&level=r00](https://alf.nu/regexgolf?world=regex&level=r00)':6 'alf.nu':5 'alf.nu/regexgolf?world=regex&level=r00](https://alf.nu/regexgolf?world=regex&level=r00)':4 'high':2 'recommend':3"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ca/comment/5870032"
+editedAt: null
+createdAt: DateTimeImmutable @1703458182 {#4977
date: 2023-12-24 23:49:42.0 +01:00
}
} |
|
Show voter details
|
| 129 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 130 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5256
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4981
+user: App\Entity\User {#4994 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "I highly recommend [alf.nu/RegexGolf?world=regex&level=r00](https://alf.nu/RegexGolf?world=regex&level=r00)"
+lang: "en"
+isAdult: false
+favouriteCount: 4
+score: 0
+lastActive: DateTime @1707640644 {#4976
date: 2024-02-11 09:37:24.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4982 …}
+nested: Doctrine\ORM\PersistentCollection {#4984 …}
+votes: Doctrine\ORM\PersistentCollection {#4986 …}
+reports: Doctrine\ORM\PersistentCollection {#4988 …}
+favourites: Doctrine\ORM\PersistentCollection {#4990 …}
+notifications: Doctrine\ORM\PersistentCollection {#4992 …}
-id: 249710
-bodyTs: "'/regexgolf?world=regex&level=r00](https://alf.nu/regexgolf?world=regex&level=r00)':6 'alf.nu':5 'alf.nu/regexgolf?world=regex&level=r00](https://alf.nu/regexgolf?world=regex&level=r00)':4 'high':2 'recommend':3"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ca/comment/5870032"
+editedAt: null
+createdAt: DateTimeImmutable @1703458182 {#4977
date: 2023-12-24 23:49:42.0 +01:00
}
}
+root: App\Entity\EntryComment {#4981}
+body: "That looks like a great way to practice"
+lang: "en"
+isAdult: false
+favouriteCount: 0
+score: 0
+lastActive: DateTime @1703472066 {#5254
date: 2023-12-25 03:41:06.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@adespoton@lemmy.ca"
]
+children: Doctrine\ORM\PersistentCollection {#5257 …}
+nested: Doctrine\ORM\PersistentCollection {#5259 …}
+votes: Doctrine\ORM\PersistentCollection {#5261 …}
+reports: Doctrine\ORM\PersistentCollection {#5263 …}
+favourites: Doctrine\ORM\PersistentCollection {#5265 …}
+notifications: Doctrine\ORM\PersistentCollection {#5267 …}
-id: 250147
-bodyTs: "'great':5 'like':3 'look':2 'practic':8 'way':6"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230634"
+editedAt: null
+createdAt: DateTimeImmutable @1703472066 {#5255
date: 2023-12-25 03:41:06.0 +01:00
}
} |
|
Show voter details
|
| 131 |
DENIED
|
edit
|
App\Entity\EntryComment {#5256
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4981
+user: App\Entity\User {#4994 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "I highly recommend [alf.nu/RegexGolf?world=regex&level=r00](https://alf.nu/RegexGolf?world=regex&level=r00)"
+lang: "en"
+isAdult: false
+favouriteCount: 4
+score: 0
+lastActive: DateTime @1707640644 {#4976
date: 2024-02-11 09:37:24.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4982 …}
+nested: Doctrine\ORM\PersistentCollection {#4984 …}
+votes: Doctrine\ORM\PersistentCollection {#4986 …}
+reports: Doctrine\ORM\PersistentCollection {#4988 …}
+favourites: Doctrine\ORM\PersistentCollection {#4990 …}
+notifications: Doctrine\ORM\PersistentCollection {#4992 …}
-id: 249710
-bodyTs: "'/regexgolf?world=regex&level=r00](https://alf.nu/regexgolf?world=regex&level=r00)':6 'alf.nu':5 'alf.nu/regexgolf?world=regex&level=r00](https://alf.nu/regexgolf?world=regex&level=r00)':4 'high':2 'recommend':3"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ca/comment/5870032"
+editedAt: null
+createdAt: DateTimeImmutable @1703458182 {#4977
date: 2023-12-24 23:49:42.0 +01:00
}
}
+root: App\Entity\EntryComment {#4981}
+body: "That looks like a great way to practice"
+lang: "en"
+isAdult: false
+favouriteCount: 0
+score: 0
+lastActive: DateTime @1703472066 {#5254
date: 2023-12-25 03:41:06.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@adespoton@lemmy.ca"
]
+children: Doctrine\ORM\PersistentCollection {#5257 …}
+nested: Doctrine\ORM\PersistentCollection {#5259 …}
+votes: Doctrine\ORM\PersistentCollection {#5261 …}
+reports: Doctrine\ORM\PersistentCollection {#5263 …}
+favourites: Doctrine\ORM\PersistentCollection {#5265 …}
+notifications: Doctrine\ORM\PersistentCollection {#5267 …}
-id: 250147
-bodyTs: "'great':5 'like':3 'look':2 'practic':8 'way':6"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230634"
+editedAt: null
+createdAt: DateTimeImmutable @1703472066 {#5255
date: 2023-12-25 03:41:06.0 +01:00
}
} |
|
Show voter details
|
| 132 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5256
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4981
+user: App\Entity\User {#4994 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "I highly recommend [alf.nu/RegexGolf?world=regex&level=r00](https://alf.nu/RegexGolf?world=regex&level=r00)"
+lang: "en"
+isAdult: false
+favouriteCount: 4
+score: 0
+lastActive: DateTime @1707640644 {#4976
date: 2024-02-11 09:37:24.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4982 …}
+nested: Doctrine\ORM\PersistentCollection {#4984 …}
+votes: Doctrine\ORM\PersistentCollection {#4986 …}
+reports: Doctrine\ORM\PersistentCollection {#4988 …}
+favourites: Doctrine\ORM\PersistentCollection {#4990 …}
+notifications: Doctrine\ORM\PersistentCollection {#4992 …}
-id: 249710
-bodyTs: "'/regexgolf?world=regex&level=r00](https://alf.nu/regexgolf?world=regex&level=r00)':6 'alf.nu':5 'alf.nu/regexgolf?world=regex&level=r00](https://alf.nu/regexgolf?world=regex&level=r00)':4 'high':2 'recommend':3"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ca/comment/5870032"
+editedAt: null
+createdAt: DateTimeImmutable @1703458182 {#4977
date: 2023-12-24 23:49:42.0 +01:00
}
}
+root: App\Entity\EntryComment {#4981}
+body: "That looks like a great way to practice"
+lang: "en"
+isAdult: false
+favouriteCount: 0
+score: 0
+lastActive: DateTime @1703472066 {#5254
date: 2023-12-25 03:41:06.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@adespoton@lemmy.ca"
]
+children: Doctrine\ORM\PersistentCollection {#5257 …}
+nested: Doctrine\ORM\PersistentCollection {#5259 …}
+votes: Doctrine\ORM\PersistentCollection {#5261 …}
+reports: Doctrine\ORM\PersistentCollection {#5263 …}
+favourites: Doctrine\ORM\PersistentCollection {#5265 …}
+notifications: Doctrine\ORM\PersistentCollection {#5267 …}
-id: 250147
-bodyTs: "'great':5 'like':3 'look':2 'practic':8 'way':6"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230634"
+editedAt: null
+createdAt: DateTimeImmutable @1703472066 {#5255
date: 2023-12-25 03:41:06.0 +01:00
}
} |
|
Show voter details
|
| 133 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 134 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5464
+user: App\Entity\User {#4994 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5256
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4981
+user: App\Entity\User {#4994 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "I highly recommend [alf.nu/RegexGolf?world=regex&level=r00](https://alf.nu/RegexGolf?world=regex&level=r00)"
+lang: "en"
+isAdult: false
+favouriteCount: 4
+score: 0
+lastActive: DateTime @1707640644 {#4976
date: 2024-02-11 09:37:24.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4982 …}
+nested: Doctrine\ORM\PersistentCollection {#4984 …}
+votes: Doctrine\ORM\PersistentCollection {#4986 …}
+reports: Doctrine\ORM\PersistentCollection {#4988 …}
+favourites: Doctrine\ORM\PersistentCollection {#4990 …}
+notifications: Doctrine\ORM\PersistentCollection {#4992 …}
-id: 249710
-bodyTs: "'/regexgolf?world=regex&level=r00](https://alf.nu/regexgolf?world=regex&level=r00)':6 'alf.nu':5 'alf.nu/regexgolf?world=regex&level=r00](https://alf.nu/regexgolf?world=regex&level=r00)':4 'high':2 'recommend':3"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ca/comment/5870032"
+editedAt: null
+createdAt: DateTimeImmutable @1703458182 {#4977
date: 2023-12-24 23:49:42.0 +01:00
}
}
+root: App\Entity\EntryComment {#4981}
+body: "That looks like a great way to practice"
+lang: "en"
+isAdult: false
+favouriteCount: 0
+score: 0
+lastActive: DateTime @1703472066 {#5254
date: 2023-12-25 03:41:06.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@adespoton@lemmy.ca"
]
+children: Doctrine\ORM\PersistentCollection {#5257 …}
+nested: Doctrine\ORM\PersistentCollection {#5259 …}
+votes: Doctrine\ORM\PersistentCollection {#5261 …}
+reports: Doctrine\ORM\PersistentCollection {#5263 …}
+favourites: Doctrine\ORM\PersistentCollection {#5265 …}
+notifications: Doctrine\ORM\PersistentCollection {#5267 …}
-id: 250147
-bodyTs: "'great':5 'like':3 'look':2 'practic':8 'way':6"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230634"
+editedAt: null
+createdAt: DateTimeImmutable @1703472066 {#5255
date: 2023-12-25 03:41:06.0 +01:00
}
}
+root: App\Entity\EntryComment {#4981}
+body: "It’s definitely a way to get your regex-fu to the next level, especially if you have people to compete against."
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703472461 {#5462
date: 2023-12-25 03:47:41.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@adespoton@lemmy.ca"
]
+children: Doctrine\ORM\PersistentCollection {#5465 …}
+nested: Doctrine\ORM\PersistentCollection {#5467 …}
+votes: Doctrine\ORM\PersistentCollection {#5469 …}
+reports: Doctrine\ORM\PersistentCollection {#5471 …}
+favourites: Doctrine\ORM\PersistentCollection {#5473 …}
+notifications: Doctrine\ORM\PersistentCollection {#5475 …}
-id: 250165
-bodyTs: "'compet':22 'definit':3 'especi':16 'fu':11 'get':7 'level':15 'next':14 'peopl':20 'regex':10 'regex-fu':9 'way':5"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ca/comment/5872762"
+editedAt: null
+createdAt: DateTimeImmutable @1703472461 {#5463
date: 2023-12-25 03:47:41.0 +01:00
}
} |
|
Show voter details
|
| 135 |
DENIED
|
edit
|
App\Entity\EntryComment {#5464
+user: App\Entity\User {#4994 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5256
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4981
+user: App\Entity\User {#4994 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "I highly recommend [alf.nu/RegexGolf?world=regex&level=r00](https://alf.nu/RegexGolf?world=regex&level=r00)"
+lang: "en"
+isAdult: false
+favouriteCount: 4
+score: 0
+lastActive: DateTime @1707640644 {#4976
date: 2024-02-11 09:37:24.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4982 …}
+nested: Doctrine\ORM\PersistentCollection {#4984 …}
+votes: Doctrine\ORM\PersistentCollection {#4986 …}
+reports: Doctrine\ORM\PersistentCollection {#4988 …}
+favourites: Doctrine\ORM\PersistentCollection {#4990 …}
+notifications: Doctrine\ORM\PersistentCollection {#4992 …}
-id: 249710
-bodyTs: "'/regexgolf?world=regex&level=r00](https://alf.nu/regexgolf?world=regex&level=r00)':6 'alf.nu':5 'alf.nu/regexgolf?world=regex&level=r00](https://alf.nu/regexgolf?world=regex&level=r00)':4 'high':2 'recommend':3"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ca/comment/5870032"
+editedAt: null
+createdAt: DateTimeImmutable @1703458182 {#4977
date: 2023-12-24 23:49:42.0 +01:00
}
}
+root: App\Entity\EntryComment {#4981}
+body: "That looks like a great way to practice"
+lang: "en"
+isAdult: false
+favouriteCount: 0
+score: 0
+lastActive: DateTime @1703472066 {#5254
date: 2023-12-25 03:41:06.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@adespoton@lemmy.ca"
]
+children: Doctrine\ORM\PersistentCollection {#5257 …}
+nested: Doctrine\ORM\PersistentCollection {#5259 …}
+votes: Doctrine\ORM\PersistentCollection {#5261 …}
+reports: Doctrine\ORM\PersistentCollection {#5263 …}
+favourites: Doctrine\ORM\PersistentCollection {#5265 …}
+notifications: Doctrine\ORM\PersistentCollection {#5267 …}
-id: 250147
-bodyTs: "'great':5 'like':3 'look':2 'practic':8 'way':6"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230634"
+editedAt: null
+createdAt: DateTimeImmutable @1703472066 {#5255
date: 2023-12-25 03:41:06.0 +01:00
}
}
+root: App\Entity\EntryComment {#4981}
+body: "It’s definitely a way to get your regex-fu to the next level, especially if you have people to compete against."
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703472461 {#5462
date: 2023-12-25 03:47:41.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@adespoton@lemmy.ca"
]
+children: Doctrine\ORM\PersistentCollection {#5465 …}
+nested: Doctrine\ORM\PersistentCollection {#5467 …}
+votes: Doctrine\ORM\PersistentCollection {#5469 …}
+reports: Doctrine\ORM\PersistentCollection {#5471 …}
+favourites: Doctrine\ORM\PersistentCollection {#5473 …}
+notifications: Doctrine\ORM\PersistentCollection {#5475 …}
-id: 250165
-bodyTs: "'compet':22 'definit':3 'especi':16 'fu':11 'get':7 'level':15 'next':14 'peopl':20 'regex':10 'regex-fu':9 'way':5"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ca/comment/5872762"
+editedAt: null
+createdAt: DateTimeImmutable @1703472461 {#5463
date: 2023-12-25 03:47:41.0 +01:00
}
} |
|
Show voter details
|
| 136 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5464
+user: App\Entity\User {#4994 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5256
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4981
+user: App\Entity\User {#4994 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "I highly recommend [alf.nu/RegexGolf?world=regex&level=r00](https://alf.nu/RegexGolf?world=regex&level=r00)"
+lang: "en"
+isAdult: false
+favouriteCount: 4
+score: 0
+lastActive: DateTime @1707640644 {#4976
date: 2024-02-11 09:37:24.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4982 …}
+nested: Doctrine\ORM\PersistentCollection {#4984 …}
+votes: Doctrine\ORM\PersistentCollection {#4986 …}
+reports: Doctrine\ORM\PersistentCollection {#4988 …}
+favourites: Doctrine\ORM\PersistentCollection {#4990 …}
+notifications: Doctrine\ORM\PersistentCollection {#4992 …}
-id: 249710
-bodyTs: "'/regexgolf?world=regex&level=r00](https://alf.nu/regexgolf?world=regex&level=r00)':6 'alf.nu':5 'alf.nu/regexgolf?world=regex&level=r00](https://alf.nu/regexgolf?world=regex&level=r00)':4 'high':2 'recommend':3"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ca/comment/5870032"
+editedAt: null
+createdAt: DateTimeImmutable @1703458182 {#4977
date: 2023-12-24 23:49:42.0 +01:00
}
}
+root: App\Entity\EntryComment {#4981}
+body: "That looks like a great way to practice"
+lang: "en"
+isAdult: false
+favouriteCount: 0
+score: 0
+lastActive: DateTime @1703472066 {#5254
date: 2023-12-25 03:41:06.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@adespoton@lemmy.ca"
]
+children: Doctrine\ORM\PersistentCollection {#5257 …}
+nested: Doctrine\ORM\PersistentCollection {#5259 …}
+votes: Doctrine\ORM\PersistentCollection {#5261 …}
+reports: Doctrine\ORM\PersistentCollection {#5263 …}
+favourites: Doctrine\ORM\PersistentCollection {#5265 …}
+notifications: Doctrine\ORM\PersistentCollection {#5267 …}
-id: 250147
-bodyTs: "'great':5 'like':3 'look':2 'practic':8 'way':6"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230634"
+editedAt: null
+createdAt: DateTimeImmutable @1703472066 {#5255
date: 2023-12-25 03:41:06.0 +01:00
}
}
+root: App\Entity\EntryComment {#4981}
+body: "It’s definitely a way to get your regex-fu to the next level, especially if you have people to compete against."
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703472461 {#5462
date: 2023-12-25 03:47:41.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@adespoton@lemmy.ca"
]
+children: Doctrine\ORM\PersistentCollection {#5465 …}
+nested: Doctrine\ORM\PersistentCollection {#5467 …}
+votes: Doctrine\ORM\PersistentCollection {#5469 …}
+reports: Doctrine\ORM\PersistentCollection {#5471 …}
+favourites: Doctrine\ORM\PersistentCollection {#5473 …}
+notifications: Doctrine\ORM\PersistentCollection {#5475 …}
-id: 250165
-bodyTs: "'compet':22 'definit':3 'especi':16 'fu':11 'get':7 'level':15 'next':14 'peopl':20 'regex':10 'regex-fu':9 'way':5"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ca/comment/5872762"
+editedAt: null
+createdAt: DateTimeImmutable @1703472461 {#5463
date: 2023-12-25 03:47:41.0 +01:00
}
} |
|
Show voter details
|
| 137 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 138 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5534
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5464
+user: App\Entity\User {#4994 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5256
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4981
+user: App\Entity\User {#4994 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "I highly recommend [alf.nu/RegexGolf?world=regex&level=r00](https://alf.nu/RegexGolf?world=regex&level=r00)"
+lang: "en"
+isAdult: false
+favouriteCount: 4
+score: 0
+lastActive: DateTime @1707640644 {#4976
date: 2024-02-11 09:37:24.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4982 …}
+nested: Doctrine\ORM\PersistentCollection {#4984 …}
+votes: Doctrine\ORM\PersistentCollection {#4986 …}
+reports: Doctrine\ORM\PersistentCollection {#4988 …}
+favourites: Doctrine\ORM\PersistentCollection {#4990 …}
+notifications: Doctrine\ORM\PersistentCollection {#4992 …}
-id: 249710
-bodyTs: "'/regexgolf?world=regex&level=r00](https://alf.nu/regexgolf?world=regex&level=r00)':6 'alf.nu':5 'alf.nu/regexgolf?world=regex&level=r00](https://alf.nu/regexgolf?world=regex&level=r00)':4 'high':2 'recommend':3"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ca/comment/5870032"
+editedAt: null
+createdAt: DateTimeImmutable @1703458182 {#4977
date: 2023-12-24 23:49:42.0 +01:00
}
}
+root: App\Entity\EntryComment {#4981}
+body: "That looks like a great way to practice"
+lang: "en"
+isAdult: false
+favouriteCount: 0
+score: 0
+lastActive: DateTime @1703472066 {#5254
date: 2023-12-25 03:41:06.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@adespoton@lemmy.ca"
]
+children: Doctrine\ORM\PersistentCollection {#5257 …}
+nested: Doctrine\ORM\PersistentCollection {#5259 …}
+votes: Doctrine\ORM\PersistentCollection {#5261 …}
+reports: Doctrine\ORM\PersistentCollection {#5263 …}
+favourites: Doctrine\ORM\PersistentCollection {#5265 …}
+notifications: Doctrine\ORM\PersistentCollection {#5267 …}
-id: 250147
-bodyTs: "'great':5 'like':3 'look':2 'practic':8 'way':6"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230634"
+editedAt: null
+createdAt: DateTimeImmutable @1703472066 {#5255
date: 2023-12-25 03:41:06.0 +01:00
}
}
+root: App\Entity\EntryComment {#4981}
+body: "It’s definitely a way to get your regex-fu to the next level, especially if you have people to compete against."
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703472461 {#5462
date: 2023-12-25 03:47:41.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@adespoton@lemmy.ca"
]
+children: Doctrine\ORM\PersistentCollection {#5465 …}
+nested: Doctrine\ORM\PersistentCollection {#5467 …}
+votes: Doctrine\ORM\PersistentCollection {#5469 …}
+reports: Doctrine\ORM\PersistentCollection {#5471 …}
+favourites: Doctrine\ORM\PersistentCollection {#5473 …}
+notifications: Doctrine\ORM\PersistentCollection {#5475 …}
-id: 250165
-bodyTs: "'compet':22 'definit':3 'especi':16 'fu':11 'get':7 'level':15 'next':14 'peopl':20 'regex':10 'regex-fu':9 'way':5"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ca/comment/5872762"
+editedAt: null
+createdAt: DateTimeImmutable @1703472461 {#5463
date: 2023-12-25 03:47:41.0 +01:00
}
}
+root: App\Entity\EntryComment {#4981}
+body: "Oh gosh. There are regex competitions out there, aren’t there."
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703472881 {#5535
date: 2023-12-25 03:54:41.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@adespoton@lemmy.ca"
]
+children: Doctrine\ORM\PersistentCollection {#5530 …}
+nested: Doctrine\ORM\PersistentCollection {#5525 …}
+votes: Doctrine\ORM\PersistentCollection {#5529 …}
+reports: Doctrine\ORM\PersistentCollection {#5539 …}
+favourites: Doctrine\ORM\PersistentCollection {#5541 …}
+notifications: Doctrine\ORM\PersistentCollection {#5543 …}
-id: 250170
-bodyTs: "'aren':9 'competit':6 'gosh':2 'oh':1 'regex':5"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230754"
+editedAt: null
+createdAt: DateTimeImmutable @1703472881 {#5538
date: 2023-12-25 03:54:41.0 +01:00
}
} |
|
Show voter details
|
| 139 |
DENIED
|
edit
|
App\Entity\EntryComment {#5534
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5464
+user: App\Entity\User {#4994 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5256
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4981
+user: App\Entity\User {#4994 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "I highly recommend [alf.nu/RegexGolf?world=regex&level=r00](https://alf.nu/RegexGolf?world=regex&level=r00)"
+lang: "en"
+isAdult: false
+favouriteCount: 4
+score: 0
+lastActive: DateTime @1707640644 {#4976
date: 2024-02-11 09:37:24.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4982 …}
+nested: Doctrine\ORM\PersistentCollection {#4984 …}
+votes: Doctrine\ORM\PersistentCollection {#4986 …}
+reports: Doctrine\ORM\PersistentCollection {#4988 …}
+favourites: Doctrine\ORM\PersistentCollection {#4990 …}
+notifications: Doctrine\ORM\PersistentCollection {#4992 …}
-id: 249710
-bodyTs: "'/regexgolf?world=regex&level=r00](https://alf.nu/regexgolf?world=regex&level=r00)':6 'alf.nu':5 'alf.nu/regexgolf?world=regex&level=r00](https://alf.nu/regexgolf?world=regex&level=r00)':4 'high':2 'recommend':3"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ca/comment/5870032"
+editedAt: null
+createdAt: DateTimeImmutable @1703458182 {#4977
date: 2023-12-24 23:49:42.0 +01:00
}
}
+root: App\Entity\EntryComment {#4981}
+body: "That looks like a great way to practice"
+lang: "en"
+isAdult: false
+favouriteCount: 0
+score: 0
+lastActive: DateTime @1703472066 {#5254
date: 2023-12-25 03:41:06.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@adespoton@lemmy.ca"
]
+children: Doctrine\ORM\PersistentCollection {#5257 …}
+nested: Doctrine\ORM\PersistentCollection {#5259 …}
+votes: Doctrine\ORM\PersistentCollection {#5261 …}
+reports: Doctrine\ORM\PersistentCollection {#5263 …}
+favourites: Doctrine\ORM\PersistentCollection {#5265 …}
+notifications: Doctrine\ORM\PersistentCollection {#5267 …}
-id: 250147
-bodyTs: "'great':5 'like':3 'look':2 'practic':8 'way':6"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230634"
+editedAt: null
+createdAt: DateTimeImmutable @1703472066 {#5255
date: 2023-12-25 03:41:06.0 +01:00
}
}
+root: App\Entity\EntryComment {#4981}
+body: "It’s definitely a way to get your regex-fu to the next level, especially if you have people to compete against."
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703472461 {#5462
date: 2023-12-25 03:47:41.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@adespoton@lemmy.ca"
]
+children: Doctrine\ORM\PersistentCollection {#5465 …}
+nested: Doctrine\ORM\PersistentCollection {#5467 …}
+votes: Doctrine\ORM\PersistentCollection {#5469 …}
+reports: Doctrine\ORM\PersistentCollection {#5471 …}
+favourites: Doctrine\ORM\PersistentCollection {#5473 …}
+notifications: Doctrine\ORM\PersistentCollection {#5475 …}
-id: 250165
-bodyTs: "'compet':22 'definit':3 'especi':16 'fu':11 'get':7 'level':15 'next':14 'peopl':20 'regex':10 'regex-fu':9 'way':5"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ca/comment/5872762"
+editedAt: null
+createdAt: DateTimeImmutable @1703472461 {#5463
date: 2023-12-25 03:47:41.0 +01:00
}
}
+root: App\Entity\EntryComment {#4981}
+body: "Oh gosh. There are regex competitions out there, aren’t there."
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703472881 {#5535
date: 2023-12-25 03:54:41.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@adespoton@lemmy.ca"
]
+children: Doctrine\ORM\PersistentCollection {#5530 …}
+nested: Doctrine\ORM\PersistentCollection {#5525 …}
+votes: Doctrine\ORM\PersistentCollection {#5529 …}
+reports: Doctrine\ORM\PersistentCollection {#5539 …}
+favourites: Doctrine\ORM\PersistentCollection {#5541 …}
+notifications: Doctrine\ORM\PersistentCollection {#5543 …}
-id: 250170
-bodyTs: "'aren':9 'competit':6 'gosh':2 'oh':1 'regex':5"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230754"
+editedAt: null
+createdAt: DateTimeImmutable @1703472881 {#5538
date: 2023-12-25 03:54:41.0 +01:00
}
} |
|
Show voter details
|
| 140 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5534
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5464
+user: App\Entity\User {#4994 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5256
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4981
+user: App\Entity\User {#4994 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "I highly recommend [alf.nu/RegexGolf?world=regex&level=r00](https://alf.nu/RegexGolf?world=regex&level=r00)"
+lang: "en"
+isAdult: false
+favouriteCount: 4
+score: 0
+lastActive: DateTime @1707640644 {#4976
date: 2024-02-11 09:37:24.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4982 …}
+nested: Doctrine\ORM\PersistentCollection {#4984 …}
+votes: Doctrine\ORM\PersistentCollection {#4986 …}
+reports: Doctrine\ORM\PersistentCollection {#4988 …}
+favourites: Doctrine\ORM\PersistentCollection {#4990 …}
+notifications: Doctrine\ORM\PersistentCollection {#4992 …}
-id: 249710
-bodyTs: "'/regexgolf?world=regex&level=r00](https://alf.nu/regexgolf?world=regex&level=r00)':6 'alf.nu':5 'alf.nu/regexgolf?world=regex&level=r00](https://alf.nu/regexgolf?world=regex&level=r00)':4 'high':2 'recommend':3"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ca/comment/5870032"
+editedAt: null
+createdAt: DateTimeImmutable @1703458182 {#4977
date: 2023-12-24 23:49:42.0 +01:00
}
}
+root: App\Entity\EntryComment {#4981}
+body: "That looks like a great way to practice"
+lang: "en"
+isAdult: false
+favouriteCount: 0
+score: 0
+lastActive: DateTime @1703472066 {#5254
date: 2023-12-25 03:41:06.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@adespoton@lemmy.ca"
]
+children: Doctrine\ORM\PersistentCollection {#5257 …}
+nested: Doctrine\ORM\PersistentCollection {#5259 …}
+votes: Doctrine\ORM\PersistentCollection {#5261 …}
+reports: Doctrine\ORM\PersistentCollection {#5263 …}
+favourites: Doctrine\ORM\PersistentCollection {#5265 …}
+notifications: Doctrine\ORM\PersistentCollection {#5267 …}
-id: 250147
-bodyTs: "'great':5 'like':3 'look':2 'practic':8 'way':6"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230634"
+editedAt: null
+createdAt: DateTimeImmutable @1703472066 {#5255
date: 2023-12-25 03:41:06.0 +01:00
}
}
+root: App\Entity\EntryComment {#4981}
+body: "It’s definitely a way to get your regex-fu to the next level, especially if you have people to compete against."
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703472461 {#5462
date: 2023-12-25 03:47:41.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@adespoton@lemmy.ca"
]
+children: Doctrine\ORM\PersistentCollection {#5465 …}
+nested: Doctrine\ORM\PersistentCollection {#5467 …}
+votes: Doctrine\ORM\PersistentCollection {#5469 …}
+reports: Doctrine\ORM\PersistentCollection {#5471 …}
+favourites: Doctrine\ORM\PersistentCollection {#5473 …}
+notifications: Doctrine\ORM\PersistentCollection {#5475 …}
-id: 250165
-bodyTs: "'compet':22 'definit':3 'especi':16 'fu':11 'get':7 'level':15 'next':14 'peopl':20 'regex':10 'regex-fu':9 'way':5"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ca/comment/5872762"
+editedAt: null
+createdAt: DateTimeImmutable @1703472461 {#5463
date: 2023-12-25 03:47:41.0 +01:00
}
}
+root: App\Entity\EntryComment {#4981}
+body: "Oh gosh. There are regex competitions out there, aren’t there."
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703472881 {#5535
date: 2023-12-25 03:54:41.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@adespoton@lemmy.ca"
]
+children: Doctrine\ORM\PersistentCollection {#5530 …}
+nested: Doctrine\ORM\PersistentCollection {#5525 …}
+votes: Doctrine\ORM\PersistentCollection {#5529 …}
+reports: Doctrine\ORM\PersistentCollection {#5539 …}
+favourites: Doctrine\ORM\PersistentCollection {#5541 …}
+notifications: Doctrine\ORM\PersistentCollection {#5543 …}
-id: 250170
-bodyTs: "'aren':9 'competit':6 'gosh':2 'oh':1 'regex':5"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230754"
+editedAt: null
+createdAt: DateTimeImmutable @1703472881 {#5538
date: 2023-12-25 03:54:41.0 +01:00
}
} |
|
Show voter details
|
| 141 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 142 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5562
+user: App\Entity\User {#4994 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5534
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5464
+user: App\Entity\User {#4994 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5256
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4981
+user: App\Entity\User {#4994 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "I highly recommend [alf.nu/RegexGolf?world=regex&level=r00](https://alf.nu/RegexGolf?world=regex&level=r00)"
+lang: "en"
+isAdult: false
+favouriteCount: 4
+score: 0
+lastActive: DateTime @1707640644 {#4976
date: 2024-02-11 09:37:24.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4982 …}
+nested: Doctrine\ORM\PersistentCollection {#4984 …}
+votes: Doctrine\ORM\PersistentCollection {#4986 …}
+reports: Doctrine\ORM\PersistentCollection {#4988 …}
+favourites: Doctrine\ORM\PersistentCollection {#4990 …}
+notifications: Doctrine\ORM\PersistentCollection {#4992 …}
-id: 249710
-bodyTs: "'/regexgolf?world=regex&level=r00](https://alf.nu/regexgolf?world=regex&level=r00)':6 'alf.nu':5 'alf.nu/regexgolf?world=regex&level=r00](https://alf.nu/regexgolf?world=regex&level=r00)':4 'high':2 'recommend':3"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ca/comment/5870032"
+editedAt: null
+createdAt: DateTimeImmutable @1703458182 {#4977
date: 2023-12-24 23:49:42.0 +01:00
}
}
+root: App\Entity\EntryComment {#4981}
+body: "That looks like a great way to practice"
+lang: "en"
+isAdult: false
+favouriteCount: 0
+score: 0
+lastActive: DateTime @1703472066 {#5254
date: 2023-12-25 03:41:06.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@adespoton@lemmy.ca"
]
+children: Doctrine\ORM\PersistentCollection {#5257 …}
+nested: Doctrine\ORM\PersistentCollection {#5259 …}
+votes: Doctrine\ORM\PersistentCollection {#5261 …}
+reports: Doctrine\ORM\PersistentCollection {#5263 …}
+favourites: Doctrine\ORM\PersistentCollection {#5265 …}
+notifications: Doctrine\ORM\PersistentCollection {#5267 …}
-id: 250147
-bodyTs: "'great':5 'like':3 'look':2 'practic':8 'way':6"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230634"
+editedAt: null
+createdAt: DateTimeImmutable @1703472066 {#5255
date: 2023-12-25 03:41:06.0 +01:00
}
}
+root: App\Entity\EntryComment {#4981}
+body: "It’s definitely a way to get your regex-fu to the next level, especially if you have people to compete against."
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703472461 {#5462
date: 2023-12-25 03:47:41.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@adespoton@lemmy.ca"
]
+children: Doctrine\ORM\PersistentCollection {#5465 …}
+nested: Doctrine\ORM\PersistentCollection {#5467 …}
+votes: Doctrine\ORM\PersistentCollection {#5469 …}
+reports: Doctrine\ORM\PersistentCollection {#5471 …}
+favourites: Doctrine\ORM\PersistentCollection {#5473 …}
+notifications: Doctrine\ORM\PersistentCollection {#5475 …}
-id: 250165
-bodyTs: "'compet':22 'definit':3 'especi':16 'fu':11 'get':7 'level':15 'next':14 'peopl':20 'regex':10 'regex-fu':9 'way':5"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ca/comment/5872762"
+editedAt: null
+createdAt: DateTimeImmutable @1703472461 {#5463
date: 2023-12-25 03:47:41.0 +01:00
}
}
+root: App\Entity\EntryComment {#4981}
+body: "Oh gosh. There are regex competitions out there, aren’t there."
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703472881 {#5535
date: 2023-12-25 03:54:41.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@adespoton@lemmy.ca"
]
+children: Doctrine\ORM\PersistentCollection {#5530 …}
+nested: Doctrine\ORM\PersistentCollection {#5525 …}
+votes: Doctrine\ORM\PersistentCollection {#5529 …}
+reports: Doctrine\ORM\PersistentCollection {#5539 …}
+favourites: Doctrine\ORM\PersistentCollection {#5541 …}
+notifications: Doctrine\ORM\PersistentCollection {#5543 …}
-id: 250170
-bodyTs: "'aren':9 'competit':6 'gosh':2 'oh':1 'regex':5"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230754"
+editedAt: null
+createdAt: DateTimeImmutable @1703472881 {#5538
date: 2023-12-25 03:54:41.0 +01:00
}
}
+root: App\Entity\EntryComment {#4981}
+body: "Yup, including for the largest “in production” regular expression…."
+lang: "en"
+isAdult: false
+favouriteCount: 0
+score: 0
+lastActive: DateTime @1703484080 {#5567
date: 2023-12-25 07:01:20.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@adespoton@lemmy.ca"
]
+children: Doctrine\ORM\PersistentCollection {#5570 …}
+nested: Doctrine\ORM\PersistentCollection {#5574 …}
+votes: Doctrine\ORM\PersistentCollection {#5576 …}
+reports: Doctrine\ORM\PersistentCollection {#5577 …}
+favourites: Doctrine\ORM\PersistentCollection {#5579 …}
+notifications: Doctrine\ORM\PersistentCollection {#5581 …}
-id: 250409
-bodyTs: "'express':9 'includ':2 'largest':5 'product':7 'regular':8 'yup':1"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ca/comment/5874576"
+editedAt: null
+createdAt: DateTimeImmutable @1703484080 {#5564
date: 2023-12-25 07:01:20.0 +01:00
}
} |
|
Show voter details
|
| 143 |
DENIED
|
edit
|
App\Entity\EntryComment {#5562
+user: App\Entity\User {#4994 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5534
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5464
+user: App\Entity\User {#4994 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5256
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4981
+user: App\Entity\User {#4994 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "I highly recommend [alf.nu/RegexGolf?world=regex&level=r00](https://alf.nu/RegexGolf?world=regex&level=r00)"
+lang: "en"
+isAdult: false
+favouriteCount: 4
+score: 0
+lastActive: DateTime @1707640644 {#4976
date: 2024-02-11 09:37:24.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4982 …}
+nested: Doctrine\ORM\PersistentCollection {#4984 …}
+votes: Doctrine\ORM\PersistentCollection {#4986 …}
+reports: Doctrine\ORM\PersistentCollection {#4988 …}
+favourites: Doctrine\ORM\PersistentCollection {#4990 …}
+notifications: Doctrine\ORM\PersistentCollection {#4992 …}
-id: 249710
-bodyTs: "'/regexgolf?world=regex&level=r00](https://alf.nu/regexgolf?world=regex&level=r00)':6 'alf.nu':5 'alf.nu/regexgolf?world=regex&level=r00](https://alf.nu/regexgolf?world=regex&level=r00)':4 'high':2 'recommend':3"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ca/comment/5870032"
+editedAt: null
+createdAt: DateTimeImmutable @1703458182 {#4977
date: 2023-12-24 23:49:42.0 +01:00
}
}
+root: App\Entity\EntryComment {#4981}
+body: "That looks like a great way to practice"
+lang: "en"
+isAdult: false
+favouriteCount: 0
+score: 0
+lastActive: DateTime @1703472066 {#5254
date: 2023-12-25 03:41:06.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@adespoton@lemmy.ca"
]
+children: Doctrine\ORM\PersistentCollection {#5257 …}
+nested: Doctrine\ORM\PersistentCollection {#5259 …}
+votes: Doctrine\ORM\PersistentCollection {#5261 …}
+reports: Doctrine\ORM\PersistentCollection {#5263 …}
+favourites: Doctrine\ORM\PersistentCollection {#5265 …}
+notifications: Doctrine\ORM\PersistentCollection {#5267 …}
-id: 250147
-bodyTs: "'great':5 'like':3 'look':2 'practic':8 'way':6"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230634"
+editedAt: null
+createdAt: DateTimeImmutable @1703472066 {#5255
date: 2023-12-25 03:41:06.0 +01:00
}
}
+root: App\Entity\EntryComment {#4981}
+body: "It’s definitely a way to get your regex-fu to the next level, especially if you have people to compete against."
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703472461 {#5462
date: 2023-12-25 03:47:41.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@adespoton@lemmy.ca"
]
+children: Doctrine\ORM\PersistentCollection {#5465 …}
+nested: Doctrine\ORM\PersistentCollection {#5467 …}
+votes: Doctrine\ORM\PersistentCollection {#5469 …}
+reports: Doctrine\ORM\PersistentCollection {#5471 …}
+favourites: Doctrine\ORM\PersistentCollection {#5473 …}
+notifications: Doctrine\ORM\PersistentCollection {#5475 …}
-id: 250165
-bodyTs: "'compet':22 'definit':3 'especi':16 'fu':11 'get':7 'level':15 'next':14 'peopl':20 'regex':10 'regex-fu':9 'way':5"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ca/comment/5872762"
+editedAt: null
+createdAt: DateTimeImmutable @1703472461 {#5463
date: 2023-12-25 03:47:41.0 +01:00
}
}
+root: App\Entity\EntryComment {#4981}
+body: "Oh gosh. There are regex competitions out there, aren’t there."
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703472881 {#5535
date: 2023-12-25 03:54:41.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@adespoton@lemmy.ca"
]
+children: Doctrine\ORM\PersistentCollection {#5530 …}
+nested: Doctrine\ORM\PersistentCollection {#5525 …}
+votes: Doctrine\ORM\PersistentCollection {#5529 …}
+reports: Doctrine\ORM\PersistentCollection {#5539 …}
+favourites: Doctrine\ORM\PersistentCollection {#5541 …}
+notifications: Doctrine\ORM\PersistentCollection {#5543 …}
-id: 250170
-bodyTs: "'aren':9 'competit':6 'gosh':2 'oh':1 'regex':5"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230754"
+editedAt: null
+createdAt: DateTimeImmutable @1703472881 {#5538
date: 2023-12-25 03:54:41.0 +01:00
}
}
+root: App\Entity\EntryComment {#4981}
+body: "Yup, including for the largest “in production” regular expression…."
+lang: "en"
+isAdult: false
+favouriteCount: 0
+score: 0
+lastActive: DateTime @1703484080 {#5567
date: 2023-12-25 07:01:20.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@adespoton@lemmy.ca"
]
+children: Doctrine\ORM\PersistentCollection {#5570 …}
+nested: Doctrine\ORM\PersistentCollection {#5574 …}
+votes: Doctrine\ORM\PersistentCollection {#5576 …}
+reports: Doctrine\ORM\PersistentCollection {#5577 …}
+favourites: Doctrine\ORM\PersistentCollection {#5579 …}
+notifications: Doctrine\ORM\PersistentCollection {#5581 …}
-id: 250409
-bodyTs: "'express':9 'includ':2 'largest':5 'product':7 'regular':8 'yup':1"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ca/comment/5874576"
+editedAt: null
+createdAt: DateTimeImmutable @1703484080 {#5564
date: 2023-12-25 07:01:20.0 +01:00
}
} |
|
Show voter details
|
| 144 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5562
+user: App\Entity\User {#4994 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5534
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5464
+user: App\Entity\User {#4994 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5256
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#4981
+user: App\Entity\User {#4994 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "I highly recommend [alf.nu/RegexGolf?world=regex&level=r00](https://alf.nu/RegexGolf?world=regex&level=r00)"
+lang: "en"
+isAdult: false
+favouriteCount: 4
+score: 0
+lastActive: DateTime @1707640644 {#4976
date: 2024-02-11 09:37:24.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#4982 …}
+nested: Doctrine\ORM\PersistentCollection {#4984 …}
+votes: Doctrine\ORM\PersistentCollection {#4986 …}
+reports: Doctrine\ORM\PersistentCollection {#4988 …}
+favourites: Doctrine\ORM\PersistentCollection {#4990 …}
+notifications: Doctrine\ORM\PersistentCollection {#4992 …}
-id: 249710
-bodyTs: "'/regexgolf?world=regex&level=r00](https://alf.nu/regexgolf?world=regex&level=r00)':6 'alf.nu':5 'alf.nu/regexgolf?world=regex&level=r00](https://alf.nu/regexgolf?world=regex&level=r00)':4 'high':2 'recommend':3"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ca/comment/5870032"
+editedAt: null
+createdAt: DateTimeImmutable @1703458182 {#4977
date: 2023-12-24 23:49:42.0 +01:00
}
}
+root: App\Entity\EntryComment {#4981}
+body: "That looks like a great way to practice"
+lang: "en"
+isAdult: false
+favouriteCount: 0
+score: 0
+lastActive: DateTime @1703472066 {#5254
date: 2023-12-25 03:41:06.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@adespoton@lemmy.ca"
]
+children: Doctrine\ORM\PersistentCollection {#5257 …}
+nested: Doctrine\ORM\PersistentCollection {#5259 …}
+votes: Doctrine\ORM\PersistentCollection {#5261 …}
+reports: Doctrine\ORM\PersistentCollection {#5263 …}
+favourites: Doctrine\ORM\PersistentCollection {#5265 …}
+notifications: Doctrine\ORM\PersistentCollection {#5267 …}
-id: 250147
-bodyTs: "'great':5 'like':3 'look':2 'practic':8 'way':6"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230634"
+editedAt: null
+createdAt: DateTimeImmutable @1703472066 {#5255
date: 2023-12-25 03:41:06.0 +01:00
}
}
+root: App\Entity\EntryComment {#4981}
+body: "It’s definitely a way to get your regex-fu to the next level, especially if you have people to compete against."
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703472461 {#5462
date: 2023-12-25 03:47:41.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@adespoton@lemmy.ca"
]
+children: Doctrine\ORM\PersistentCollection {#5465 …}
+nested: Doctrine\ORM\PersistentCollection {#5467 …}
+votes: Doctrine\ORM\PersistentCollection {#5469 …}
+reports: Doctrine\ORM\PersistentCollection {#5471 …}
+favourites: Doctrine\ORM\PersistentCollection {#5473 …}
+notifications: Doctrine\ORM\PersistentCollection {#5475 …}
-id: 250165
-bodyTs: "'compet':22 'definit':3 'especi':16 'fu':11 'get':7 'level':15 'next':14 'peopl':20 'regex':10 'regex-fu':9 'way':5"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ca/comment/5872762"
+editedAt: null
+createdAt: DateTimeImmutable @1703472461 {#5463
date: 2023-12-25 03:47:41.0 +01:00
}
}
+root: App\Entity\EntryComment {#4981}
+body: "Oh gosh. There are regex competitions out there, aren’t there."
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703472881 {#5535
date: 2023-12-25 03:54:41.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@adespoton@lemmy.ca"
]
+children: Doctrine\ORM\PersistentCollection {#5530 …}
+nested: Doctrine\ORM\PersistentCollection {#5525 …}
+votes: Doctrine\ORM\PersistentCollection {#5529 …}
+reports: Doctrine\ORM\PersistentCollection {#5539 …}
+favourites: Doctrine\ORM\PersistentCollection {#5541 …}
+notifications: Doctrine\ORM\PersistentCollection {#5543 …}
-id: 250170
-bodyTs: "'aren':9 'competit':6 'gosh':2 'oh':1 'regex':5"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230754"
+editedAt: null
+createdAt: DateTimeImmutable @1703472881 {#5538
date: 2023-12-25 03:54:41.0 +01:00
}
}
+root: App\Entity\EntryComment {#4981}
+body: "Yup, including for the largest “in production” regular expression…."
+lang: "en"
+isAdult: false
+favouriteCount: 0
+score: 0
+lastActive: DateTime @1703484080 {#5567
date: 2023-12-25 07:01:20.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@adespoton@lemmy.ca"
]
+children: Doctrine\ORM\PersistentCollection {#5570 …}
+nested: Doctrine\ORM\PersistentCollection {#5574 …}
+votes: Doctrine\ORM\PersistentCollection {#5576 …}
+reports: Doctrine\ORM\PersistentCollection {#5577 …}
+favourites: Doctrine\ORM\PersistentCollection {#5579 …}
+notifications: Doctrine\ORM\PersistentCollection {#5581 …}
-id: 250409
-bodyTs: "'express':9 'includ':2 'largest':5 'product':7 'regular':8 'yup':1"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ca/comment/5874576"
+editedAt: null
+createdAt: DateTimeImmutable @1703484080 {#5564
date: 2023-12-25 07:01:20.0 +01:00
}
} |
|
Show voter details
|
| 145 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 146 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5054
+user: App\Entity\User {#5067 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "That’s really cool! I know some regex and I tried to learn vim regex, only to find out it’s a rabbithole so deep I’m afraid to look into. The feeling when you press enter and your carefully crafted regex does exactly what it’s supposed to do is awesome though. Good luck!"
+lang: "en"
+isAdult: false
+favouriteCount: 2
+score: 0
+lastActive: DateTime @1707674703 {#5049
date: 2024-02-11 19:05:03.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5055 …}
+nested: Doctrine\ORM\PersistentCollection {#5057 …}
+votes: Doctrine\ORM\PersistentCollection {#5059 …}
+reports: Doctrine\ORM\PersistentCollection {#5061 …}
+favourites: Doctrine\ORM\PersistentCollection {#5063 …}
+notifications: Doctrine\ORM\PersistentCollection {#5065 …}
-id: 249708
-bodyTs: "'afraid':28 'awesom':52 'care':40 'cool':4 'craft':41 'deep':25 'enter':37 'exact':44 'feel':33 'find':18 'good':54 'know':6 'learn':13 'look':30 'luck':55 'm':27 'press':36 'rabbithol':23 'realli':3 'regex':8,15,42 'suppos':48 'though':53 'tri':11 'vim':14"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://iusearchlinux.fyi/comment/4314487"
+editedAt: null
+createdAt: DateTimeImmutable @1703458148 {#5050
date: 2023-12-24 23:49:08.0 +01:00
}
} |
|
Show voter details
|
| 147 |
DENIED
|
edit
|
App\Entity\EntryComment {#5054
+user: App\Entity\User {#5067 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "That’s really cool! I know some regex and I tried to learn vim regex, only to find out it’s a rabbithole so deep I’m afraid to look into. The feeling when you press enter and your carefully crafted regex does exactly what it’s supposed to do is awesome though. Good luck!"
+lang: "en"
+isAdult: false
+favouriteCount: 2
+score: 0
+lastActive: DateTime @1707674703 {#5049
date: 2024-02-11 19:05:03.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5055 …}
+nested: Doctrine\ORM\PersistentCollection {#5057 …}
+votes: Doctrine\ORM\PersistentCollection {#5059 …}
+reports: Doctrine\ORM\PersistentCollection {#5061 …}
+favourites: Doctrine\ORM\PersistentCollection {#5063 …}
+notifications: Doctrine\ORM\PersistentCollection {#5065 …}
-id: 249708
-bodyTs: "'afraid':28 'awesom':52 'care':40 'cool':4 'craft':41 'deep':25 'enter':37 'exact':44 'feel':33 'find':18 'good':54 'know':6 'learn':13 'look':30 'luck':55 'm':27 'press':36 'rabbithol':23 'realli':3 'regex':8,15,42 'suppos':48 'though':53 'tri':11 'vim':14"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://iusearchlinux.fyi/comment/4314487"
+editedAt: null
+createdAt: DateTimeImmutable @1703458148 {#5050
date: 2023-12-24 23:49:08.0 +01:00
}
} |
|
Show voter details
|
| 148 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5054
+user: App\Entity\User {#5067 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "That’s really cool! I know some regex and I tried to learn vim regex, only to find out it’s a rabbithole so deep I’m afraid to look into. The feeling when you press enter and your carefully crafted regex does exactly what it’s supposed to do is awesome though. Good luck!"
+lang: "en"
+isAdult: false
+favouriteCount: 2
+score: 0
+lastActive: DateTime @1707674703 {#5049
date: 2024-02-11 19:05:03.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5055 …}
+nested: Doctrine\ORM\PersistentCollection {#5057 …}
+votes: Doctrine\ORM\PersistentCollection {#5059 …}
+reports: Doctrine\ORM\PersistentCollection {#5061 …}
+favourites: Doctrine\ORM\PersistentCollection {#5063 …}
+notifications: Doctrine\ORM\PersistentCollection {#5065 …}
-id: 249708
-bodyTs: "'afraid':28 'awesom':52 'care':40 'cool':4 'craft':41 'deep':25 'enter':37 'exact':44 'feel':33 'find':18 'good':54 'know':6 'learn':13 'look':30 'luck':55 'm':27 'press':36 'rabbithol':23 'realli':3 'regex':8,15,42 'suppos':48 'though':53 'tri':11 'vim':14"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://iusearchlinux.fyi/comment/4314487"
+editedAt: null
+createdAt: DateTimeImmutable @1703458148 {#5050
date: 2023-12-24 23:49:08.0 +01:00
}
} |
|
Show voter details
|
| 149 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 150 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5241
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5054
+user: App\Entity\User {#5067 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "That’s really cool! I know some regex and I tried to learn vim regex, only to find out it’s a rabbithole so deep I’m afraid to look into. The feeling when you press enter and your carefully crafted regex does exactly what it’s supposed to do is awesome though. Good luck!"
+lang: "en"
+isAdult: false
+favouriteCount: 2
+score: 0
+lastActive: DateTime @1707674703 {#5049
date: 2024-02-11 19:05:03.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5055 …}
+nested: Doctrine\ORM\PersistentCollection {#5057 …}
+votes: Doctrine\ORM\PersistentCollection {#5059 …}
+reports: Doctrine\ORM\PersistentCollection {#5061 …}
+favourites: Doctrine\ORM\PersistentCollection {#5063 …}
+notifications: Doctrine\ORM\PersistentCollection {#5065 …}
-id: 249708
-bodyTs: "'afraid':28 'awesom':52 'care':40 'cool':4 'craft':41 'deep':25 'enter':37 'exact':44 'feel':33 'find':18 'good':54 'know':6 'learn':13 'look':30 'luck':55 'm':27 'press':36 'rabbithol':23 'realli':3 'regex':8,15,42 'suppos':48 'though':53 'tri':11 'vim':14"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://iusearchlinux.fyi/comment/4314487"
+editedAt: null
+createdAt: DateTimeImmutable @1703458148 {#5050
date: 2023-12-24 23:49:08.0 +01:00
}
}
+root: App\Entity\EntryComment {#5054}
+body: "Vim is on my list of things to learn. I didn’t even know vim had its own regex, but I suppose that makes sense. I’ve messed with vim a bit, but have stuck to nano so far."
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703472141 {#5239
date: 2023-12-25 03:42:21.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@stepanzak@iusearchlinux.fyi"
]
+children: Doctrine\ORM\PersistentCollection {#5242 …}
+nested: Doctrine\ORM\PersistentCollection {#5244 …}
+votes: Doctrine\ORM\PersistentCollection {#5246 …}
+reports: Doctrine\ORM\PersistentCollection {#5248 …}
+favourites: Doctrine\ORM\PersistentCollection {#5250 …}
+notifications: Doctrine\ORM\PersistentCollection {#5252 …}
-id: 250152
-bodyTs: "'bit':32 'didn':11 'even':13 'far':39 'know':14 'learn':9 'list':5 'make':24 'mess':28 'nano':37 'regex':19 'sens':25 'stuck':35 'suppos':22 'thing':7 've':27 'vim':1,15,30"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230647"
+editedAt: null
+createdAt: DateTimeImmutable @1703472141 {#5240
date: 2023-12-25 03:42:21.0 +01:00
}
} |
|
Show voter details
|
| 151 |
DENIED
|
edit
|
App\Entity\EntryComment {#5241
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5054
+user: App\Entity\User {#5067 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "That’s really cool! I know some regex and I tried to learn vim regex, only to find out it’s a rabbithole so deep I’m afraid to look into. The feeling when you press enter and your carefully crafted regex does exactly what it’s supposed to do is awesome though. Good luck!"
+lang: "en"
+isAdult: false
+favouriteCount: 2
+score: 0
+lastActive: DateTime @1707674703 {#5049
date: 2024-02-11 19:05:03.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5055 …}
+nested: Doctrine\ORM\PersistentCollection {#5057 …}
+votes: Doctrine\ORM\PersistentCollection {#5059 …}
+reports: Doctrine\ORM\PersistentCollection {#5061 …}
+favourites: Doctrine\ORM\PersistentCollection {#5063 …}
+notifications: Doctrine\ORM\PersistentCollection {#5065 …}
-id: 249708
-bodyTs: "'afraid':28 'awesom':52 'care':40 'cool':4 'craft':41 'deep':25 'enter':37 'exact':44 'feel':33 'find':18 'good':54 'know':6 'learn':13 'look':30 'luck':55 'm':27 'press':36 'rabbithol':23 'realli':3 'regex':8,15,42 'suppos':48 'though':53 'tri':11 'vim':14"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://iusearchlinux.fyi/comment/4314487"
+editedAt: null
+createdAt: DateTimeImmutable @1703458148 {#5050
date: 2023-12-24 23:49:08.0 +01:00
}
}
+root: App\Entity\EntryComment {#5054}
+body: "Vim is on my list of things to learn. I didn’t even know vim had its own regex, but I suppose that makes sense. I’ve messed with vim a bit, but have stuck to nano so far."
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703472141 {#5239
date: 2023-12-25 03:42:21.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@stepanzak@iusearchlinux.fyi"
]
+children: Doctrine\ORM\PersistentCollection {#5242 …}
+nested: Doctrine\ORM\PersistentCollection {#5244 …}
+votes: Doctrine\ORM\PersistentCollection {#5246 …}
+reports: Doctrine\ORM\PersistentCollection {#5248 …}
+favourites: Doctrine\ORM\PersistentCollection {#5250 …}
+notifications: Doctrine\ORM\PersistentCollection {#5252 …}
-id: 250152
-bodyTs: "'bit':32 'didn':11 'even':13 'far':39 'know':14 'learn':9 'list':5 'make':24 'mess':28 'nano':37 'regex':19 'sens':25 'stuck':35 'suppos':22 'thing':7 've':27 'vim':1,15,30"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230647"
+editedAt: null
+createdAt: DateTimeImmutable @1703472141 {#5240
date: 2023-12-25 03:42:21.0 +01:00
}
} |
|
Show voter details
|
| 152 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5241
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5054
+user: App\Entity\User {#5067 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "That’s really cool! I know some regex and I tried to learn vim regex, only to find out it’s a rabbithole so deep I’m afraid to look into. The feeling when you press enter and your carefully crafted regex does exactly what it’s supposed to do is awesome though. Good luck!"
+lang: "en"
+isAdult: false
+favouriteCount: 2
+score: 0
+lastActive: DateTime @1707674703 {#5049
date: 2024-02-11 19:05:03.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5055 …}
+nested: Doctrine\ORM\PersistentCollection {#5057 …}
+votes: Doctrine\ORM\PersistentCollection {#5059 …}
+reports: Doctrine\ORM\PersistentCollection {#5061 …}
+favourites: Doctrine\ORM\PersistentCollection {#5063 …}
+notifications: Doctrine\ORM\PersistentCollection {#5065 …}
-id: 249708
-bodyTs: "'afraid':28 'awesom':52 'care':40 'cool':4 'craft':41 'deep':25 'enter':37 'exact':44 'feel':33 'find':18 'good':54 'know':6 'learn':13 'look':30 'luck':55 'm':27 'press':36 'rabbithol':23 'realli':3 'regex':8,15,42 'suppos':48 'though':53 'tri':11 'vim':14"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://iusearchlinux.fyi/comment/4314487"
+editedAt: null
+createdAt: DateTimeImmutable @1703458148 {#5050
date: 2023-12-24 23:49:08.0 +01:00
}
}
+root: App\Entity\EntryComment {#5054}
+body: "Vim is on my list of things to learn. I didn’t even know vim had its own regex, but I suppose that makes sense. I’ve messed with vim a bit, but have stuck to nano so far."
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703472141 {#5239
date: 2023-12-25 03:42:21.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@stepanzak@iusearchlinux.fyi"
]
+children: Doctrine\ORM\PersistentCollection {#5242 …}
+nested: Doctrine\ORM\PersistentCollection {#5244 …}
+votes: Doctrine\ORM\PersistentCollection {#5246 …}
+reports: Doctrine\ORM\PersistentCollection {#5248 …}
+favourites: Doctrine\ORM\PersistentCollection {#5250 …}
+notifications: Doctrine\ORM\PersistentCollection {#5252 …}
-id: 250152
-bodyTs: "'bit':32 'didn':11 'even':13 'far':39 'know':14 'learn':9 'list':5 'make':24 'mess':28 'nano':37 'regex':19 'sens':25 'stuck':35 'suppos':22 'thing':7 've':27 'vim':1,15,30"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230647"
+editedAt: null
+createdAt: DateTimeImmutable @1703472141 {#5240
date: 2023-12-25 03:42:21.0 +01:00
}
} |
|
Show voter details
|
| 153 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 154 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5479
+user: App\Entity\User {#5067 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5241
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5054
+user: App\Entity\User {#5067 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "That’s really cool! I know some regex and I tried to learn vim regex, only to find out it’s a rabbithole so deep I’m afraid to look into. The feeling when you press enter and your carefully crafted regex does exactly what it’s supposed to do is awesome though. Good luck!"
+lang: "en"
+isAdult: false
+favouriteCount: 2
+score: 0
+lastActive: DateTime @1707674703 {#5049
date: 2024-02-11 19:05:03.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5055 …}
+nested: Doctrine\ORM\PersistentCollection {#5057 …}
+votes: Doctrine\ORM\PersistentCollection {#5059 …}
+reports: Doctrine\ORM\PersistentCollection {#5061 …}
+favourites: Doctrine\ORM\PersistentCollection {#5063 …}
+notifications: Doctrine\ORM\PersistentCollection {#5065 …}
-id: 249708
-bodyTs: "'afraid':28 'awesom':52 'care':40 'cool':4 'craft':41 'deep':25 'enter':37 'exact':44 'feel':33 'find':18 'good':54 'know':6 'learn':13 'look':30 'luck':55 'm':27 'press':36 'rabbithol':23 'realli':3 'regex':8,15,42 'suppos':48 'though':53 'tri':11 'vim':14"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://iusearchlinux.fyi/comment/4314487"
+editedAt: null
+createdAt: DateTimeImmutable @1703458148 {#5050
date: 2023-12-24 23:49:08.0 +01:00
}
}
+root: App\Entity\EntryComment {#5054}
+body: "Vim is on my list of things to learn. I didn’t even know vim had its own regex, but I suppose that makes sense. I’ve messed with vim a bit, but have stuck to nano so far."
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703472141 {#5239
date: 2023-12-25 03:42:21.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@stepanzak@iusearchlinux.fyi"
]
+children: Doctrine\ORM\PersistentCollection {#5242 …}
+nested: Doctrine\ORM\PersistentCollection {#5244 …}
+votes: Doctrine\ORM\PersistentCollection {#5246 …}
+reports: Doctrine\ORM\PersistentCollection {#5248 …}
+favourites: Doctrine\ORM\PersistentCollection {#5250 …}
+notifications: Doctrine\ORM\PersistentCollection {#5252 …}
-id: 250152
-bodyTs: "'bit':32 'didn':11 'even':13 'far':39 'know':14 'learn':9 'list':5 'make':24 'mess':28 'nano':37 'regex':19 'sens':25 'stuck':35 'suppos':22 'thing':7 've':27 'vim':1,15,30"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230647"
+editedAt: null
+createdAt: DateTimeImmutable @1703472141 {#5240
date: 2023-12-25 03:42:21.0 +01:00
}
}
+root: App\Entity\EntryComment {#5054}
+body: "You might also like [micro](https://github.com/zyedidia/micro)"
+lang: "en"
+isAdult: false
+favouriteCount: 0
+score: 0
+lastActive: DateTime @1703499760 {#5477
date: 2023-12-25 11:22:40.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@stepanzak@iusearchlinux.fyi"
]
+children: Doctrine\ORM\PersistentCollection {#5480 …}
+nested: Doctrine\ORM\PersistentCollection {#5482 …}
+votes: Doctrine\ORM\PersistentCollection {#5484 …}
+reports: Doctrine\ORM\PersistentCollection {#5486 …}
+favourites: Doctrine\ORM\PersistentCollection {#5488 …}
+notifications: Doctrine\ORM\PersistentCollection {#5490 …}
-id: 250734
-bodyTs: "'/zyedidia/micro)':8 'also':3 'github.com':7 'github.com/zyedidia/micro)':6 'like':4 'micro':5 'might':2"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://iusearchlinux.fyi/comment/4319670"
+editedAt: null
+createdAt: DateTimeImmutable @1703499760 {#5478
date: 2023-12-25 11:22:40.0 +01:00
}
} |
|
Show voter details
|
| 155 |
DENIED
|
edit
|
App\Entity\EntryComment {#5479
+user: App\Entity\User {#5067 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5241
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5054
+user: App\Entity\User {#5067 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "That’s really cool! I know some regex and I tried to learn vim regex, only to find out it’s a rabbithole so deep I’m afraid to look into. The feeling when you press enter and your carefully crafted regex does exactly what it’s supposed to do is awesome though. Good luck!"
+lang: "en"
+isAdult: false
+favouriteCount: 2
+score: 0
+lastActive: DateTime @1707674703 {#5049
date: 2024-02-11 19:05:03.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5055 …}
+nested: Doctrine\ORM\PersistentCollection {#5057 …}
+votes: Doctrine\ORM\PersistentCollection {#5059 …}
+reports: Doctrine\ORM\PersistentCollection {#5061 …}
+favourites: Doctrine\ORM\PersistentCollection {#5063 …}
+notifications: Doctrine\ORM\PersistentCollection {#5065 …}
-id: 249708
-bodyTs: "'afraid':28 'awesom':52 'care':40 'cool':4 'craft':41 'deep':25 'enter':37 'exact':44 'feel':33 'find':18 'good':54 'know':6 'learn':13 'look':30 'luck':55 'm':27 'press':36 'rabbithol':23 'realli':3 'regex':8,15,42 'suppos':48 'though':53 'tri':11 'vim':14"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://iusearchlinux.fyi/comment/4314487"
+editedAt: null
+createdAt: DateTimeImmutable @1703458148 {#5050
date: 2023-12-24 23:49:08.0 +01:00
}
}
+root: App\Entity\EntryComment {#5054}
+body: "Vim is on my list of things to learn. I didn’t even know vim had its own regex, but I suppose that makes sense. I’ve messed with vim a bit, but have stuck to nano so far."
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703472141 {#5239
date: 2023-12-25 03:42:21.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@stepanzak@iusearchlinux.fyi"
]
+children: Doctrine\ORM\PersistentCollection {#5242 …}
+nested: Doctrine\ORM\PersistentCollection {#5244 …}
+votes: Doctrine\ORM\PersistentCollection {#5246 …}
+reports: Doctrine\ORM\PersistentCollection {#5248 …}
+favourites: Doctrine\ORM\PersistentCollection {#5250 …}
+notifications: Doctrine\ORM\PersistentCollection {#5252 …}
-id: 250152
-bodyTs: "'bit':32 'didn':11 'even':13 'far':39 'know':14 'learn':9 'list':5 'make':24 'mess':28 'nano':37 'regex':19 'sens':25 'stuck':35 'suppos':22 'thing':7 've':27 'vim':1,15,30"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230647"
+editedAt: null
+createdAt: DateTimeImmutable @1703472141 {#5240
date: 2023-12-25 03:42:21.0 +01:00
}
}
+root: App\Entity\EntryComment {#5054}
+body: "You might also like [micro](https://github.com/zyedidia/micro)"
+lang: "en"
+isAdult: false
+favouriteCount: 0
+score: 0
+lastActive: DateTime @1703499760 {#5477
date: 2023-12-25 11:22:40.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@stepanzak@iusearchlinux.fyi"
]
+children: Doctrine\ORM\PersistentCollection {#5480 …}
+nested: Doctrine\ORM\PersistentCollection {#5482 …}
+votes: Doctrine\ORM\PersistentCollection {#5484 …}
+reports: Doctrine\ORM\PersistentCollection {#5486 …}
+favourites: Doctrine\ORM\PersistentCollection {#5488 …}
+notifications: Doctrine\ORM\PersistentCollection {#5490 …}
-id: 250734
-bodyTs: "'/zyedidia/micro)':8 'also':3 'github.com':7 'github.com/zyedidia/micro)':6 'like':4 'micro':5 'might':2"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://iusearchlinux.fyi/comment/4319670"
+editedAt: null
+createdAt: DateTimeImmutable @1703499760 {#5478
date: 2023-12-25 11:22:40.0 +01:00
}
} |
|
Show voter details
|
| 156 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5479
+user: App\Entity\User {#5067 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5241
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5054
+user: App\Entity\User {#5067 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: "That’s really cool! I know some regex and I tried to learn vim regex, only to find out it’s a rabbithole so deep I’m afraid to look into. The feeling when you press enter and your carefully crafted regex does exactly what it’s supposed to do is awesome though. Good luck!"
+lang: "en"
+isAdult: false
+favouriteCount: 2
+score: 0
+lastActive: DateTime @1707674703 {#5049
date: 2024-02-11 19:05:03.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5055 …}
+nested: Doctrine\ORM\PersistentCollection {#5057 …}
+votes: Doctrine\ORM\PersistentCollection {#5059 …}
+reports: Doctrine\ORM\PersistentCollection {#5061 …}
+favourites: Doctrine\ORM\PersistentCollection {#5063 …}
+notifications: Doctrine\ORM\PersistentCollection {#5065 …}
-id: 249708
-bodyTs: "'afraid':28 'awesom':52 'care':40 'cool':4 'craft':41 'deep':25 'enter':37 'exact':44 'feel':33 'find':18 'good':54 'know':6 'learn':13 'look':30 'luck':55 'm':27 'press':36 'rabbithol':23 'realli':3 'regex':8,15,42 'suppos':48 'though':53 'tri':11 'vim':14"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://iusearchlinux.fyi/comment/4314487"
+editedAt: null
+createdAt: DateTimeImmutable @1703458148 {#5050
date: 2023-12-24 23:49:08.0 +01:00
}
}
+root: App\Entity\EntryComment {#5054}
+body: "Vim is on my list of things to learn. I didn’t even know vim had its own regex, but I suppose that makes sense. I’ve messed with vim a bit, but have stuck to nano so far."
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703472141 {#5239
date: 2023-12-25 03:42:21.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@stepanzak@iusearchlinux.fyi"
]
+children: Doctrine\ORM\PersistentCollection {#5242 …}
+nested: Doctrine\ORM\PersistentCollection {#5244 …}
+votes: Doctrine\ORM\PersistentCollection {#5246 …}
+reports: Doctrine\ORM\PersistentCollection {#5248 …}
+favourites: Doctrine\ORM\PersistentCollection {#5250 …}
+notifications: Doctrine\ORM\PersistentCollection {#5252 …}
-id: 250152
-bodyTs: "'bit':32 'didn':11 'even':13 'far':39 'know':14 'learn':9 'list':5 'make':24 'mess':28 'nano':37 'regex':19 'sens':25 'stuck':35 'suppos':22 'thing':7 've':27 'vim':1,15,30"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230647"
+editedAt: null
+createdAt: DateTimeImmutable @1703472141 {#5240
date: 2023-12-25 03:42:21.0 +01:00
}
}
+root: App\Entity\EntryComment {#5054}
+body: "You might also like [micro](https://github.com/zyedidia/micro)"
+lang: "en"
+isAdult: false
+favouriteCount: 0
+score: 0
+lastActive: DateTime @1703499760 {#5477
date: 2023-12-25 11:22:40.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@stepanzak@iusearchlinux.fyi"
]
+children: Doctrine\ORM\PersistentCollection {#5480 …}
+nested: Doctrine\ORM\PersistentCollection {#5482 …}
+votes: Doctrine\ORM\PersistentCollection {#5484 …}
+reports: Doctrine\ORM\PersistentCollection {#5486 …}
+favourites: Doctrine\ORM\PersistentCollection {#5488 …}
+notifications: Doctrine\ORM\PersistentCollection {#5490 …}
-id: 250734
-bodyTs: "'/zyedidia/micro)':8 'also':3 'github.com':7 'github.com/zyedidia/micro)':6 'like':4 'micro':5 'might':2"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://iusearchlinux.fyi/comment/4319670"
+editedAt: null
+createdAt: DateTimeImmutable @1703499760 {#5478
date: 2023-12-25 11:22:40.0 +01:00
}
} |
|
Show voter details
|
| 157 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 158 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5127
+user: App\Entity\User {#5140 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
Knowledge and understanding. Feels good, man.\n
\n
Obligatory [Xkcd](https://xkcd.com/208/).\n
\n

"""
+lang: "en"
+isAdult: false
+favouriteCount: 112
+score: 0
+lastActive: DateTime @1707964958 {#5122
date: 2024-02-15 03:42:38.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5128 …}
+nested: Doctrine\ORM\PersistentCollection {#5130 …}
+votes: Doctrine\ORM\PersistentCollection {#5132 …}
+reports: Doctrine\ORM\PersistentCollection {#5134 …}
+favourites: Doctrine\ORM\PersistentCollection {#5136 …}
+notifications: Doctrine\ORM\PersistentCollection {#5138 …}
-id: 249692
-bodyTs: "'/208/).':11 '/pictrs/image/d6d2db0a-cf5a-4270-b4bb-a898d9b88695.png)':14 'feel':4 'good':5 'knowledg':1 'man':6 'obligatori':7 'sh.itjust.works':13 'sh.itjust.works/pictrs/image/d6d2db0a-cf5a-4270-b4bb-a898d9b88695.png)':12 'understand':3 'xkcd':8 'xkcd.com':10 'xkcd.com/208/).':9"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://sh.itjust.works/comment/6822487"
+editedAt: null
+createdAt: DateTimeImmutable @1703457775 {#5123
date: 2023-12-24 23:42:55.0 +01:00
}
} |
|
Show voter details
|
| 159 |
DENIED
|
edit
|
App\Entity\EntryComment {#5127
+user: App\Entity\User {#5140 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
Knowledge and understanding. Feels good, man.\n
\n
Obligatory [Xkcd](https://xkcd.com/208/).\n
\n

"""
+lang: "en"
+isAdult: false
+favouriteCount: 112
+score: 0
+lastActive: DateTime @1707964958 {#5122
date: 2024-02-15 03:42:38.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5128 …}
+nested: Doctrine\ORM\PersistentCollection {#5130 …}
+votes: Doctrine\ORM\PersistentCollection {#5132 …}
+reports: Doctrine\ORM\PersistentCollection {#5134 …}
+favourites: Doctrine\ORM\PersistentCollection {#5136 …}
+notifications: Doctrine\ORM\PersistentCollection {#5138 …}
-id: 249692
-bodyTs: "'/208/).':11 '/pictrs/image/d6d2db0a-cf5a-4270-b4bb-a898d9b88695.png)':14 'feel':4 'good':5 'knowledg':1 'man':6 'obligatori':7 'sh.itjust.works':13 'sh.itjust.works/pictrs/image/d6d2db0a-cf5a-4270-b4bb-a898d9b88695.png)':12 'understand':3 'xkcd':8 'xkcd.com':10 'xkcd.com/208/).':9"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://sh.itjust.works/comment/6822487"
+editedAt: null
+createdAt: DateTimeImmutable @1703457775 {#5123
date: 2023-12-24 23:42:55.0 +01:00
}
} |
|
Show voter details
|
| 160 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5127
+user: App\Entity\User {#5140 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
Knowledge and understanding. Feels good, man.\n
\n
Obligatory [Xkcd](https://xkcd.com/208/).\n
\n

"""
+lang: "en"
+isAdult: false
+favouriteCount: 112
+score: 0
+lastActive: DateTime @1707964958 {#5122
date: 2024-02-15 03:42:38.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5128 …}
+nested: Doctrine\ORM\PersistentCollection {#5130 …}
+votes: Doctrine\ORM\PersistentCollection {#5132 …}
+reports: Doctrine\ORM\PersistentCollection {#5134 …}
+favourites: Doctrine\ORM\PersistentCollection {#5136 …}
+notifications: Doctrine\ORM\PersistentCollection {#5138 …}
-id: 249692
-bodyTs: "'/208/).':11 '/pictrs/image/d6d2db0a-cf5a-4270-b4bb-a898d9b88695.png)':14 'feel':4 'good':5 'knowledg':1 'man':6 'obligatori':7 'sh.itjust.works':13 'sh.itjust.works/pictrs/image/d6d2db0a-cf5a-4270-b4bb-a898d9b88695.png)':12 'understand':3 'xkcd':8 'xkcd.com':10 'xkcd.com/208/).':9"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://sh.itjust.works/comment/6822487"
+editedAt: null
+createdAt: DateTimeImmutable @1703457775 {#5123
date: 2023-12-24 23:42:55.0 +01:00
}
} |
|
Show voter details
|
| 161 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 162 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5211
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5127
+user: App\Entity\User {#5140 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
Knowledge and understanding. Feels good, man.\n
\n
Obligatory [Xkcd](https://xkcd.com/208/).\n
\n

"""
+lang: "en"
+isAdult: false
+favouriteCount: 112
+score: 0
+lastActive: DateTime @1707964958 {#5122
date: 2024-02-15 03:42:38.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5128 …}
+nested: Doctrine\ORM\PersistentCollection {#5130 …}
+votes: Doctrine\ORM\PersistentCollection {#5132 …}
+reports: Doctrine\ORM\PersistentCollection {#5134 …}
+favourites: Doctrine\ORM\PersistentCollection {#5136 …}
+notifications: Doctrine\ORM\PersistentCollection {#5138 …}
-id: 249692
-bodyTs: "'/208/).':11 '/pictrs/image/d6d2db0a-cf5a-4270-b4bb-a898d9b88695.png)':14 'feel':4 'good':5 'knowledg':1 'man':6 'obligatori':7 'sh.itjust.works':13 'sh.itjust.works/pictrs/image/d6d2db0a-cf5a-4270-b4bb-a898d9b88695.png)':12 'understand':3 'xkcd':8 'xkcd.com':10 'xkcd.com/208/).':9"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://sh.itjust.works/comment/6822487"
+editedAt: null
+createdAt: DateTimeImmutable @1703457775 {#5123
date: 2023-12-24 23:42:55.0 +01:00
}
}
+root: App\Entity\EntryComment {#5127}
+body: "It does feel good! And thanks for that xkcd! That one’s new to me."
+lang: "en"
+isAdult: false
+favouriteCount: 24
+score: 0
+lastActive: DateTime @1703458123 {#5212
date: 2023-12-24 23:48:43.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@leo@sh.itjust.works"
]
+children: Doctrine\ORM\PersistentCollection {#5208 …}
+nested: Doctrine\ORM\PersistentCollection {#5204 …}
+votes: Doctrine\ORM\PersistentCollection {#5202 …}
+reports: Doctrine\ORM\PersistentCollection {#5217 …}
+favourites: Doctrine\ORM\PersistentCollection {#5219 …}
+notifications: Doctrine\ORM\PersistentCollection {#5221 …}
-id: 249705
-bodyTs: "'feel':3 'good':4 'new':13 'one':11 'thank':6 'xkcd':9"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6228148"
+editedAt: null
+createdAt: DateTimeImmutable @1703458123 {#5215
date: 2023-12-24 23:48:43.0 +01:00
}
} |
|
Show voter details
|
| 163 |
DENIED
|
edit
|
App\Entity\EntryComment {#5211
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5127
+user: App\Entity\User {#5140 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
Knowledge and understanding. Feels good, man.\n
\n
Obligatory [Xkcd](https://xkcd.com/208/).\n
\n

"""
+lang: "en"
+isAdult: false
+favouriteCount: 112
+score: 0
+lastActive: DateTime @1707964958 {#5122
date: 2024-02-15 03:42:38.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5128 …}
+nested: Doctrine\ORM\PersistentCollection {#5130 …}
+votes: Doctrine\ORM\PersistentCollection {#5132 …}
+reports: Doctrine\ORM\PersistentCollection {#5134 …}
+favourites: Doctrine\ORM\PersistentCollection {#5136 …}
+notifications: Doctrine\ORM\PersistentCollection {#5138 …}
-id: 249692
-bodyTs: "'/208/).':11 '/pictrs/image/d6d2db0a-cf5a-4270-b4bb-a898d9b88695.png)':14 'feel':4 'good':5 'knowledg':1 'man':6 'obligatori':7 'sh.itjust.works':13 'sh.itjust.works/pictrs/image/d6d2db0a-cf5a-4270-b4bb-a898d9b88695.png)':12 'understand':3 'xkcd':8 'xkcd.com':10 'xkcd.com/208/).':9"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://sh.itjust.works/comment/6822487"
+editedAt: null
+createdAt: DateTimeImmutable @1703457775 {#5123
date: 2023-12-24 23:42:55.0 +01:00
}
}
+root: App\Entity\EntryComment {#5127}
+body: "It does feel good! And thanks for that xkcd! That one’s new to me."
+lang: "en"
+isAdult: false
+favouriteCount: 24
+score: 0
+lastActive: DateTime @1703458123 {#5212
date: 2023-12-24 23:48:43.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@leo@sh.itjust.works"
]
+children: Doctrine\ORM\PersistentCollection {#5208 …}
+nested: Doctrine\ORM\PersistentCollection {#5204 …}
+votes: Doctrine\ORM\PersistentCollection {#5202 …}
+reports: Doctrine\ORM\PersistentCollection {#5217 …}
+favourites: Doctrine\ORM\PersistentCollection {#5219 …}
+notifications: Doctrine\ORM\PersistentCollection {#5221 …}
-id: 249705
-bodyTs: "'feel':3 'good':4 'new':13 'one':11 'thank':6 'xkcd':9"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6228148"
+editedAt: null
+createdAt: DateTimeImmutable @1703458123 {#5215
date: 2023-12-24 23:48:43.0 +01:00
}
} |
|
Show voter details
|
| 164 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5211
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5127
+user: App\Entity\User {#5140 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
Knowledge and understanding. Feels good, man.\n
\n
Obligatory [Xkcd](https://xkcd.com/208/).\n
\n

"""
+lang: "en"
+isAdult: false
+favouriteCount: 112
+score: 0
+lastActive: DateTime @1707964958 {#5122
date: 2024-02-15 03:42:38.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5128 …}
+nested: Doctrine\ORM\PersistentCollection {#5130 …}
+votes: Doctrine\ORM\PersistentCollection {#5132 …}
+reports: Doctrine\ORM\PersistentCollection {#5134 …}
+favourites: Doctrine\ORM\PersistentCollection {#5136 …}
+notifications: Doctrine\ORM\PersistentCollection {#5138 …}
-id: 249692
-bodyTs: "'/208/).':11 '/pictrs/image/d6d2db0a-cf5a-4270-b4bb-a898d9b88695.png)':14 'feel':4 'good':5 'knowledg':1 'man':6 'obligatori':7 'sh.itjust.works':13 'sh.itjust.works/pictrs/image/d6d2db0a-cf5a-4270-b4bb-a898d9b88695.png)':12 'understand':3 'xkcd':8 'xkcd.com':10 'xkcd.com/208/).':9"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://sh.itjust.works/comment/6822487"
+editedAt: null
+createdAt: DateTimeImmutable @1703457775 {#5123
date: 2023-12-24 23:42:55.0 +01:00
}
}
+root: App\Entity\EntryComment {#5127}
+body: "It does feel good! And thanks for that xkcd! That one’s new to me."
+lang: "en"
+isAdult: false
+favouriteCount: 24
+score: 0
+lastActive: DateTime @1703458123 {#5212
date: 2023-12-24 23:48:43.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@leo@sh.itjust.works"
]
+children: Doctrine\ORM\PersistentCollection {#5208 …}
+nested: Doctrine\ORM\PersistentCollection {#5204 …}
+votes: Doctrine\ORM\PersistentCollection {#5202 …}
+reports: Doctrine\ORM\PersistentCollection {#5217 …}
+favourites: Doctrine\ORM\PersistentCollection {#5219 …}
+notifications: Doctrine\ORM\PersistentCollection {#5221 …}
-id: 249705
-bodyTs: "'feel':3 'good':4 'new':13 'one':11 'thank':6 'xkcd':9"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6228148"
+editedAt: null
+createdAt: DateTimeImmutable @1703458123 {#5215
date: 2023-12-24 23:48:43.0 +01:00
}
} |
|
Show voter details
|
| 165 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 166 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5225
+user: Proxies\__CG__\App\Entity\User {#5226 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5127
+user: App\Entity\User {#5140 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
Knowledge and understanding. Feels good, man.\n
\n
Obligatory [Xkcd](https://xkcd.com/208/).\n
\n

"""
+lang: "en"
+isAdult: false
+favouriteCount: 112
+score: 0
+lastActive: DateTime @1707964958 {#5122
date: 2024-02-15 03:42:38.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5128 …}
+nested: Doctrine\ORM\PersistentCollection {#5130 …}
+votes: Doctrine\ORM\PersistentCollection {#5132 …}
+reports: Doctrine\ORM\PersistentCollection {#5134 …}
+favourites: Doctrine\ORM\PersistentCollection {#5136 …}
+notifications: Doctrine\ORM\PersistentCollection {#5138 …}
-id: 249692
-bodyTs: "'/208/).':11 '/pictrs/image/d6d2db0a-cf5a-4270-b4bb-a898d9b88695.png)':14 'feel':4 'good':5 'knowledg':1 'man':6 'obligatori':7 'sh.itjust.works':13 'sh.itjust.works/pictrs/image/d6d2db0a-cf5a-4270-b4bb-a898d9b88695.png)':12 'understand':3 'xkcd':8 'xkcd.com':10 'xkcd.com/208/).':9"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://sh.itjust.works/comment/6822487"
+editedAt: null
+createdAt: DateTimeImmutable @1703457775 {#5123
date: 2023-12-24 23:42:55.0 +01:00
}
}
+root: App\Entity\EntryComment {#5127}
+body: "Ah…the days when perl was the shit and python was still a glimmer in the eye of some frustrated programmer."
+lang: "en"
+isAdult: false
+favouriteCount: 20
+score: 0
+lastActive: DateTime @1703471577 {#5223
date: 2023-12-25 03:32:57.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@leo@sh.itjust.works"
]
+children: Doctrine\ORM\PersistentCollection {#5227 …}
+nested: Doctrine\ORM\PersistentCollection {#5229 …}
+votes: Doctrine\ORM\PersistentCollection {#5231 …}
+reports: Doctrine\ORM\PersistentCollection {#5233 …}
+favourites: Doctrine\ORM\PersistentCollection {#5235 …}
+notifications: Doctrine\ORM\PersistentCollection {#5237 …}
-id: 250130
-bodyTs: "'ah':1 'day':3 'eye':17 'frustrat':20 'glimmer':14 'perl':5 'programm':21 'python':10 'shit':8 'still':12"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230543"
+editedAt: null
+createdAt: DateTimeImmutable @1703471577 {#5224
date: 2023-12-25 03:32:57.0 +01:00
}
} |
|
Show voter details
|
| 167 |
DENIED
|
edit
|
App\Entity\EntryComment {#5225
+user: Proxies\__CG__\App\Entity\User {#5226 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5127
+user: App\Entity\User {#5140 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
Knowledge and understanding. Feels good, man.\n
\n
Obligatory [Xkcd](https://xkcd.com/208/).\n
\n

"""
+lang: "en"
+isAdult: false
+favouriteCount: 112
+score: 0
+lastActive: DateTime @1707964958 {#5122
date: 2024-02-15 03:42:38.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5128 …}
+nested: Doctrine\ORM\PersistentCollection {#5130 …}
+votes: Doctrine\ORM\PersistentCollection {#5132 …}
+reports: Doctrine\ORM\PersistentCollection {#5134 …}
+favourites: Doctrine\ORM\PersistentCollection {#5136 …}
+notifications: Doctrine\ORM\PersistentCollection {#5138 …}
-id: 249692
-bodyTs: "'/208/).':11 '/pictrs/image/d6d2db0a-cf5a-4270-b4bb-a898d9b88695.png)':14 'feel':4 'good':5 'knowledg':1 'man':6 'obligatori':7 'sh.itjust.works':13 'sh.itjust.works/pictrs/image/d6d2db0a-cf5a-4270-b4bb-a898d9b88695.png)':12 'understand':3 'xkcd':8 'xkcd.com':10 'xkcd.com/208/).':9"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://sh.itjust.works/comment/6822487"
+editedAt: null
+createdAt: DateTimeImmutable @1703457775 {#5123
date: 2023-12-24 23:42:55.0 +01:00
}
}
+root: App\Entity\EntryComment {#5127}
+body: "Ah…the days when perl was the shit and python was still a glimmer in the eye of some frustrated programmer."
+lang: "en"
+isAdult: false
+favouriteCount: 20
+score: 0
+lastActive: DateTime @1703471577 {#5223
date: 2023-12-25 03:32:57.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@leo@sh.itjust.works"
]
+children: Doctrine\ORM\PersistentCollection {#5227 …}
+nested: Doctrine\ORM\PersistentCollection {#5229 …}
+votes: Doctrine\ORM\PersistentCollection {#5231 …}
+reports: Doctrine\ORM\PersistentCollection {#5233 …}
+favourites: Doctrine\ORM\PersistentCollection {#5235 …}
+notifications: Doctrine\ORM\PersistentCollection {#5237 …}
-id: 250130
-bodyTs: "'ah':1 'day':3 'eye':17 'frustrat':20 'glimmer':14 'perl':5 'programm':21 'python':10 'shit':8 'still':12"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230543"
+editedAt: null
+createdAt: DateTimeImmutable @1703471577 {#5224
date: 2023-12-25 03:32:57.0 +01:00
}
} |
|
Show voter details
|
| 168 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5225
+user: Proxies\__CG__\App\Entity\User {#5226 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5127
+user: App\Entity\User {#5140 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
Knowledge and understanding. Feels good, man.\n
\n
Obligatory [Xkcd](https://xkcd.com/208/).\n
\n

"""
+lang: "en"
+isAdult: false
+favouriteCount: 112
+score: 0
+lastActive: DateTime @1707964958 {#5122
date: 2024-02-15 03:42:38.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5128 …}
+nested: Doctrine\ORM\PersistentCollection {#5130 …}
+votes: Doctrine\ORM\PersistentCollection {#5132 …}
+reports: Doctrine\ORM\PersistentCollection {#5134 …}
+favourites: Doctrine\ORM\PersistentCollection {#5136 …}
+notifications: Doctrine\ORM\PersistentCollection {#5138 …}
-id: 249692
-bodyTs: "'/208/).':11 '/pictrs/image/d6d2db0a-cf5a-4270-b4bb-a898d9b88695.png)':14 'feel':4 'good':5 'knowledg':1 'man':6 'obligatori':7 'sh.itjust.works':13 'sh.itjust.works/pictrs/image/d6d2db0a-cf5a-4270-b4bb-a898d9b88695.png)':12 'understand':3 'xkcd':8 'xkcd.com':10 'xkcd.com/208/).':9"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://sh.itjust.works/comment/6822487"
+editedAt: null
+createdAt: DateTimeImmutable @1703457775 {#5123
date: 2023-12-24 23:42:55.0 +01:00
}
}
+root: App\Entity\EntryComment {#5127}
+body: "Ah…the days when perl was the shit and python was still a glimmer in the eye of some frustrated programmer."
+lang: "en"
+isAdult: false
+favouriteCount: 20
+score: 0
+lastActive: DateTime @1703471577 {#5223
date: 2023-12-25 03:32:57.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@leo@sh.itjust.works"
]
+children: Doctrine\ORM\PersistentCollection {#5227 …}
+nested: Doctrine\ORM\PersistentCollection {#5229 …}
+votes: Doctrine\ORM\PersistentCollection {#5231 …}
+reports: Doctrine\ORM\PersistentCollection {#5233 …}
+favourites: Doctrine\ORM\PersistentCollection {#5235 …}
+notifications: Doctrine\ORM\PersistentCollection {#5237 …}
-id: 250130
-bodyTs: "'ah':1 'day':3 'eye':17 'frustrat':20 'glimmer':14 'perl':5 'programm':21 'python':10 'shit':8 'still':12"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230543"
+editedAt: null
+createdAt: DateTimeImmutable @1703471577 {#5224
date: 2023-12-25 03:32:57.0 +01:00
}
} |
|
Show voter details
|
| 169 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
| 170 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5449
+user: Proxies\__CG__\App\Entity\User {#5446 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5225
+user: Proxies\__CG__\App\Entity\User {#5226 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5127
+user: App\Entity\User {#5140 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
Knowledge and understanding. Feels good, man.\n
\n
Obligatory [Xkcd](https://xkcd.com/208/).\n
\n

"""
+lang: "en"
+isAdult: false
+favouriteCount: 112
+score: 0
+lastActive: DateTime @1707964958 {#5122
date: 2024-02-15 03:42:38.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5128 …}
+nested: Doctrine\ORM\PersistentCollection {#5130 …}
+votes: Doctrine\ORM\PersistentCollection {#5132 …}
+reports: Doctrine\ORM\PersistentCollection {#5134 …}
+favourites: Doctrine\ORM\PersistentCollection {#5136 …}
+notifications: Doctrine\ORM\PersistentCollection {#5138 …}
-id: 249692
-bodyTs: "'/208/).':11 '/pictrs/image/d6d2db0a-cf5a-4270-b4bb-a898d9b88695.png)':14 'feel':4 'good':5 'knowledg':1 'man':6 'obligatori':7 'sh.itjust.works':13 'sh.itjust.works/pictrs/image/d6d2db0a-cf5a-4270-b4bb-a898d9b88695.png)':12 'understand':3 'xkcd':8 'xkcd.com':10 'xkcd.com/208/).':9"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://sh.itjust.works/comment/6822487"
+editedAt: null
+createdAt: DateTimeImmutable @1703457775 {#5123
date: 2023-12-24 23:42:55.0 +01:00
}
}
+root: App\Entity\EntryComment {#5127}
+body: "Ah…the days when perl was the shit and python was still a glimmer in the eye of some frustrated programmer."
+lang: "en"
+isAdult: false
+favouriteCount: 20
+score: 0
+lastActive: DateTime @1703471577 {#5223
date: 2023-12-25 03:32:57.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@leo@sh.itjust.works"
]
+children: Doctrine\ORM\PersistentCollection {#5227 …}
+nested: Doctrine\ORM\PersistentCollection {#5229 …}
+votes: Doctrine\ORM\PersistentCollection {#5231 …}
+reports: Doctrine\ORM\PersistentCollection {#5233 …}
+favourites: Doctrine\ORM\PersistentCollection {#5235 …}
+notifications: Doctrine\ORM\PersistentCollection {#5237 …}
-id: 250130
-bodyTs: "'ah':1 'day':3 'eye':17 'frustrat':20 'glimmer':14 'perl':5 'programm':21 'python':10 'shit':8 'still':12"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230543"
+editedAt: null
+createdAt: DateTimeImmutable @1703471577 {#5224
date: 2023-12-25 03:32:57.0 +01:00
}
}
+root: App\Entity\EntryComment {#5127}
+body: "[Relevant xkcd (specifically the alt text)](https://xkcd.com/353/)"
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703604213 {#5450
date: 2023-12-26 16:23:33.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@leo@sh.itjust.works"
"@CosmicTurtle@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5443 …}
+nested: Doctrine\ORM\PersistentCollection {#5441 …}
+votes: Doctrine\ORM\PersistentCollection {#5445 …}
+reports: Doctrine\ORM\PersistentCollection {#5456 …}
+favourites: Doctrine\ORM\PersistentCollection {#5458 …}
+notifications: Doctrine\ORM\PersistentCollection {#5460 …}
-id: 253802
-bodyTs: "'/353/)':9 'alt':5 'relev':1 'specif':3 'text':6 'xkcd':2 'xkcd.com':8 'xkcd.com/353/)':7"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ca/comment/5893071"
+editedAt: null
+createdAt: DateTimeImmutable @1703604213 {#5453
date: 2023-12-26 16:23:33.0 +01:00
}
} |
|
Show voter details
|
| 171 |
DENIED
|
edit
|
App\Entity\EntryComment {#5449
+user: Proxies\__CG__\App\Entity\User {#5446 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5225
+user: Proxies\__CG__\App\Entity\User {#5226 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5127
+user: App\Entity\User {#5140 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
Knowledge and understanding. Feels good, man.\n
\n
Obligatory [Xkcd](https://xkcd.com/208/).\n
\n

"""
+lang: "en"
+isAdult: false
+favouriteCount: 112
+score: 0
+lastActive: DateTime @1707964958 {#5122
date: 2024-02-15 03:42:38.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5128 …}
+nested: Doctrine\ORM\PersistentCollection {#5130 …}
+votes: Doctrine\ORM\PersistentCollection {#5132 …}
+reports: Doctrine\ORM\PersistentCollection {#5134 …}
+favourites: Doctrine\ORM\PersistentCollection {#5136 …}
+notifications: Doctrine\ORM\PersistentCollection {#5138 …}
-id: 249692
-bodyTs: "'/208/).':11 '/pictrs/image/d6d2db0a-cf5a-4270-b4bb-a898d9b88695.png)':14 'feel':4 'good':5 'knowledg':1 'man':6 'obligatori':7 'sh.itjust.works':13 'sh.itjust.works/pictrs/image/d6d2db0a-cf5a-4270-b4bb-a898d9b88695.png)':12 'understand':3 'xkcd':8 'xkcd.com':10 'xkcd.com/208/).':9"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://sh.itjust.works/comment/6822487"
+editedAt: null
+createdAt: DateTimeImmutable @1703457775 {#5123
date: 2023-12-24 23:42:55.0 +01:00
}
}
+root: App\Entity\EntryComment {#5127}
+body: "Ah…the days when perl was the shit and python was still a glimmer in the eye of some frustrated programmer."
+lang: "en"
+isAdult: false
+favouriteCount: 20
+score: 0
+lastActive: DateTime @1703471577 {#5223
date: 2023-12-25 03:32:57.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@leo@sh.itjust.works"
]
+children: Doctrine\ORM\PersistentCollection {#5227 …}
+nested: Doctrine\ORM\PersistentCollection {#5229 …}
+votes: Doctrine\ORM\PersistentCollection {#5231 …}
+reports: Doctrine\ORM\PersistentCollection {#5233 …}
+favourites: Doctrine\ORM\PersistentCollection {#5235 …}
+notifications: Doctrine\ORM\PersistentCollection {#5237 …}
-id: 250130
-bodyTs: "'ah':1 'day':3 'eye':17 'frustrat':20 'glimmer':14 'perl':5 'programm':21 'python':10 'shit':8 'still':12"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230543"
+editedAt: null
+createdAt: DateTimeImmutable @1703471577 {#5224
date: 2023-12-25 03:32:57.0 +01:00
}
}
+root: App\Entity\EntryComment {#5127}
+body: "[Relevant xkcd (specifically the alt text)](https://xkcd.com/353/)"
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703604213 {#5450
date: 2023-12-26 16:23:33.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@leo@sh.itjust.works"
"@CosmicTurtle@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5443 …}
+nested: Doctrine\ORM\PersistentCollection {#5441 …}
+votes: Doctrine\ORM\PersistentCollection {#5445 …}
+reports: Doctrine\ORM\PersistentCollection {#5456 …}
+favourites: Doctrine\ORM\PersistentCollection {#5458 …}
+notifications: Doctrine\ORM\PersistentCollection {#5460 …}
-id: 253802
-bodyTs: "'/353/)':9 'alt':5 'relev':1 'specif':3 'text':6 'xkcd':2 'xkcd.com':8 'xkcd.com/353/)':7"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ca/comment/5893071"
+editedAt: null
+createdAt: DateTimeImmutable @1703604213 {#5453
date: 2023-12-26 16:23:33.0 +01:00
}
} |
|
Show voter details
|
| 172 |
DENIED
|
moderate
|
App\Entity\EntryComment {#5449
+user: Proxies\__CG__\App\Entity\User {#5446 …}
+entry: App\Entity\Entry {#2400
+user: Proxies\__CG__\App\Entity\User {#1978 …}
+magazine: App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1889 …}
+slug: "My-First-Regular-Expressions"
+title: "My First Regular Expressions"
+url: null
+body: """
I’ve been reading *Mastering Regular Expressions* by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I’m pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I’m working with.\n
\n
What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.\n
\n
I’ve used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.\n
\n
I’m only about 10% of the way through the book, but already I understand so much more than I ever did about regex *(I also recognize I have a lot to learn)*.\n
\n
I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. *(movies I’ve ripped from my DVD collection and tarballed to archive them)*.\n
\n
The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:\n
\n
`tar -tzvf file.tar.gz | egrep -o ‘/[^/]*.m(kv|p4)’ > movielist`\n
\n
Which gives me a list of movies of which this is an example:\n
\n
`/The.Hunger.Games.(2012).[tmdbid-70160].mp4`\n
\n
Then I used sed with the expression groups to remove:\n
\n
- the leading forward slash\n
- Everything from `.[` to the end\n
- All of the periods in between words\n
\n
And the last expression checks for one or more spaces and replaces them with a single space.\n
\n
This is the full sed command:\n
\n
`sed -Eie ‘s/^///; s/.[[a-z]±[0-9]+].m(p4|kv)//; s/[^a-zA-Z0-9()&-]/ /g; s/ +/ /g’ movielist`\n
\n
Which leaves me with a pretty list of movies that looks like this:\n
\n
`The Hunger Games (2012)`\n
\n
I’m sure this could be done more elegantly, and I’m happy for any feedback on how to do that! For now, I’m just excited that I’m beginning to understand regex and how to use it!\n
\n
Edit: fixed title so it didn’t say “regex expressions”
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 63
+favouriteCount: 214
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1711562613 {#2414
date: 2024-03-27 19:03:33.0 +01:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1688 …}
+votes: Doctrine\ORM\PersistentCollection {#1966 …}
+reports: Doctrine\ORM\PersistentCollection {#1965 …}
+favourites: Doctrine\ORM\PersistentCollection {#1368 …}
+notifications: Doctrine\ORM\PersistentCollection {#2426 …}
+badges: Doctrine\ORM\PersistentCollection {#2439 …}
+children: []
-id: 24511
-titleTs: "'express':4 'first':2 'regular':3"
-bodyTs: "'-70160':243 '-9':302 '/g':312,314 '/the.hunger.games':240 '0':301 '10':123 '2012':241,332 '9':311 'a-z':298 'a-za-z0':307 'alreadi':131 'also':144 'archiv':187 'asid':18 'begin':363 'book':129 'care':22 'charact':76 'check':275 'clean':166 'cobbl':88 'collect':183 'command':293 'could':337 'd':26 'didn':377 'done':339 'dvd':182 'e.f':10 'edit':372 'egrep':160,201,221 'eie':295 'eleg':341 'end':263 'ever':139 'everyth':259 'exact':67 'exampl':239 'excit':359 'express':7,39,64,79,104,155,191,251,274,381 'feedback':348 'file':205,217 'file.tar.gz':220 'filenam':171 'first':35,190 'fix':373 'forward':257 'friedl':11 'full':291 'game':331 'generat':164 'get':210 'give':228 'group':252 'happi':57,345 'hunger':330 'jeffrey':9 'kv':224,305 'last':273 'lead':256 'learn':151 'leav':317 'life':17 'like':327 'list':169,203,231,322 'look':326 'lot':149 'm':30,49,55,120,223,303,334,344,357,362 'manipul':45 'master':5 'meant':105 'movi':176,233,324 'movielist':226,315 'mp4':244 'much':135 'name':213 'need':112 'never':95 'nobodi':14 'o':222 'one':196,277 'overflow':92 'p4':225,304 'past':86 'period':267 'pretti':31,321 'proud':32 'pull':172 'purpos':73 'read':4 'realli':96 'recogn':145 'regex':83,142,366,380 'regular':6,38 'remov':254 'replac':282 'rip':179 'say':379 'sed':162,248,292,294 'set':36 'share':27 'sinc':13 'singl':286 'slash':258 'someth':28 'space':280,287 'stack':91 'stuff':87 'sure':335 'tar':199,218 'tarbal':175,185,208 'text':47 'thought':24 'time':118 'titl':374 'tmdbid':242 'togeth':89 'tzvf':219 'understand':66,133,365 'understood':97 'use':82,158,197,247,370 've':2,81,178 'video':216 'way':126 'wife':21 'word':270 'work':50,100 'wrote':42,62,153,193 'z':300 'z0':310 'za':309"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1703542531
+visibility: "visible "
+apId: "https://lemmy.world/post/9942188"
+editedAt: DateTimeImmutable @1707607314 {#1793
date: 2024-02-11 00:21:54.0 +01:00
}
+createdAt: DateTimeImmutable @1703456131 {#2402
date: 2023-12-24 23:15:31.0 +01:00
}
}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5225
+user: Proxies\__CG__\App\Entity\User {#5226 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: App\Entity\EntryComment {#5127
+user: App\Entity\User {#5140 …}
+entry: App\Entity\Entry {#2400}
+magazine: App\Entity\Magazine {#265}
+image: null
+parent: null
+root: null
+body: """
Knowledge and understanding. Feels good, man.\n
\n
Obligatory [Xkcd](https://xkcd.com/208/).\n
\n

"""
+lang: "en"
+isAdult: false
+favouriteCount: 112
+score: 0
+lastActive: DateTime @1707964958 {#5122
date: 2024-02-15 03:42:38.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5128 …}
+nested: Doctrine\ORM\PersistentCollection {#5130 …}
+votes: Doctrine\ORM\PersistentCollection {#5132 …}
+reports: Doctrine\ORM\PersistentCollection {#5134 …}
+favourites: Doctrine\ORM\PersistentCollection {#5136 …}
+notifications: Doctrine\ORM\PersistentCollection {#5138 …}
-id: 249692
-bodyTs: "'/208/).':11 '/pictrs/image/d6d2db0a-cf5a-4270-b4bb-a898d9b88695.png)':14 'feel':4 'good':5 'knowledg':1 'man':6 'obligatori':7 'sh.itjust.works':13 'sh.itjust.works/pictrs/image/d6d2db0a-cf5a-4270-b4bb-a898d9b88695.png)':12 'understand':3 'xkcd':8 'xkcd.com':10 'xkcd.com/208/).':9"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://sh.itjust.works/comment/6822487"
+editedAt: null
+createdAt: DateTimeImmutable @1703457775 {#5123
date: 2023-12-24 23:42:55.0 +01:00
}
}
+root: App\Entity\EntryComment {#5127}
+body: "Ah…the days when perl was the shit and python was still a glimmer in the eye of some frustrated programmer."
+lang: "en"
+isAdult: false
+favouriteCount: 20
+score: 0
+lastActive: DateTime @1703471577 {#5223
date: 2023-12-25 03:32:57.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@leo@sh.itjust.works"
]
+children: Doctrine\ORM\PersistentCollection {#5227 …}
+nested: Doctrine\ORM\PersistentCollection {#5229 …}
+votes: Doctrine\ORM\PersistentCollection {#5231 …}
+reports: Doctrine\ORM\PersistentCollection {#5233 …}
+favourites: Doctrine\ORM\PersistentCollection {#5235 …}
+notifications: Doctrine\ORM\PersistentCollection {#5237 …}
-id: 250130
-bodyTs: "'ah':1 'day':3 'eye':17 'frustrat':20 'glimmer':14 'perl':5 'programm':21 'python':10 'shit':8 'still':12"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/6230543"
+editedAt: null
+createdAt: DateTimeImmutable @1703471577 {#5224
date: 2023-12-25 03:32:57.0 +01:00
}
}
+root: App\Entity\EntryComment {#5127}
+body: "[Relevant xkcd (specifically the alt text)](https://xkcd.com/353/)"
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1703604213 {#5450
date: 2023-12-26 16:23:33.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@harsh3466@lemmy.world"
"@leo@sh.itjust.works"
"@CosmicTurtle@lemmy.world"
]
+children: Doctrine\ORM\PersistentCollection {#5443 …}
+nested: Doctrine\ORM\PersistentCollection {#5441 …}
+votes: Doctrine\ORM\PersistentCollection {#5445 …}
+reports: Doctrine\ORM\PersistentCollection {#5456 …}
+favourites: Doctrine\ORM\PersistentCollection {#5458 …}
+notifications: Doctrine\ORM\PersistentCollection {#5460 …}
-id: 253802
-bodyTs: "'/353/)':9 'alt':5 'relev':1 'specif':3 'text':6 'xkcd':2 'xkcd.com':8 'xkcd.com/353/)':7"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ca/comment/5893071"
+editedAt: null
+createdAt: DateTimeImmutable @1703604213 {#5453
date: 2023-12-26 16:23:33.0 +01:00
}
} |
|
Show voter details
|
| 173 |
DENIED
|
edit
|
App\Entity\Magazine {#265
+icon: Proxies\__CG__\App\Entity\Image {#246 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#275
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#237 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#233 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#222 …}
+entries: Doctrine\ORM\PersistentCollection {#180 …}
+posts: Doctrine\ORM\PersistentCollection {#138 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#200 …}
+bans: Doctrine\ORM\PersistentCollection {#117 …}
+reports: Doctrine\ORM\PersistentCollection {#103 …}
+badges: Doctrine\ORM\PersistentCollection {#81 …}
+logs: Doctrine\ORM\PersistentCollection {#71 …}
+awards: Doctrine\ORM\PersistentCollection {#1346 …}
+categories: Doctrine\ORM\PersistentCollection {#1823 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#269
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#271
date: 2023-11-02 13:51:08.0 +01:00
}
} |
|
Show voter details
|