Adam on Nostr: I must have my thoughts crossed as for the life of me I can't seem to figure out this ...
I must have my thoughts crossed as for the life of me I can't seem to figure out this regex in BASH using a parameter expansion.
I want to search for 2 or more dashes and then replace with one dash. Here is what I thought would work, but doesn't.
string="Hello-World! #debug command---line"
string="${title//[-]{2,3}/-}"
#bash #regex #askfedi #AskFediverse
Published at
2023-10-20 01:40:16Event JSON
{
"id": "14b0f0ad68f3d22b917ad77f7645c1375e6d323b47905df816eaaa3826024430",
"pubkey": "f4cd659fcfa7c5ed3cb28e3ecd3479420fd6b367f3dfad0d5a6b3b4dbcbcdbb0",
"created_at": 1697766016,
"kind": 1,
"tags": [
[
"t",
"debug"
],
[
"t",
"bash"
],
[
"t",
"regex"
],
[
"t",
"askfedi"
],
[
"t",
"askfediverse"
],
[
"proxy",
"https://fosstodon.org/users/adamsdesk/statuses/111264793658624733",
"activitypub"
]
],
"content": "I must have my thoughts crossed as for the life of me I can't seem to figure out this regex in BASH using a parameter expansion.\n\nI want to search for 2 or more dashes and then replace with one dash. Here is what I thought would work, but doesn't.\n\nstring=\"Hello-World! #debug command---line\"\nstring=\"${title//[-]{2,3}/-}\"\n\n#bash #regex #askfedi #AskFediverse",
"sig": "a74391bf3df484eb6c4989b23ff5b18f013e2354a77ea51bab3e01548dbbd670cffdd74efcebe693236e53d4500f755a9f6bac5e44b71532499199c4cf835507"
}