anonymous
  • anonymous
Can someone help me with a regular expression? I'm trying to use grep to match any line that contains "/wallpaper/[letters and numbers]/[numbers]_[letters]_1440x900.jpg", and it won't work. What I currently have is "/wallpaper/[0-9a-z]+/[0-9]+_[a-zA-Z]+_1440x900\.jpg".
Computer Science
jamiebookeater
  • jamiebookeater
See more answers at brainly.com
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this
and thousands of other questions

anonymous
  • anonymous
Never mind, I got it working.
anonymous
  • anonymous
Hi, perhaps you could put your solution online, it could be helpful for some people. Thanks
anonymous
  • anonymous
I'm so sorry I didn't, of course. Somehow it was the plus operators that caused it to not work. I'm not sure if grep simply doesn't support them or something, but when I replaced plus with star, it worked perfectly.

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

shadowfiend
  • shadowfiend
Ah, for grep you'll probably want to use \+ instead. Depending on what software you're using, sometimes some characters need to be escaped to take on their special meaning. In vim, for example, the default is to treat () as regular parentheses but treat \(\) as a capturing group, which is the opposite of the way it works in, say, Perl or Ruby or Python.
anonymous
  • anonymous
Using star is not an option, doesn't do the same thing as a +. You can work around it if you want, but + is the better solution. Also, you need to escape your slashes /\.

Looking for something else?

Not the answer you are looking for? Search for more explanations.