How to get output of URL (RegExp) A.K.A Regular Expression
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How to get output of URL (RegExp) A.K.A Regular Expression
So i have found a set of regular expression i can use to grab all data, how do i make it output into .txt files in the server or into some other way so i can lookup the data.
Here is how my URL (RegExp) looks like: /(([A-Za-z]{3,9})://)?([-;:&=\+\$,\w]+@{1})?(([-A-Za-z0-9]+\.)+[A-Za-z]{2,3})(:\d+)?((/[-\+~%/\.\w]+)?/?([&?][-\+=&;%@\.\w]+)?(#[\w]+)?)?/g
How do i output this into either .txt* files names after each PC who uses it or into a server?
Thanks so i add that to the end of my RegExp and make it look like this: /(([A-Za-z]{3,9})://)?([-;:&=\+\$,\w]+@{1})?(([-A-Za-z0-9]+\.)+[A-Za-z]{2,3})(:\d+)?((/[-\+~%/\.\w]+)?/?([&?][-\+=&;%@\.\w]+)?(#[\w]+)?)?/g/ls -l > overwrite-file.txt
ls -l >> append-file.txt
Is that correct? i space it with / if i remember correctly.
The point of this RegExp is to grab all input from browsers and so on from my customers, and i wish for it to output a personanme.txt to each person
So i can grab the data from FTP later on.
Basically every person's data to be outputted into his very own .txt file.
A regex by itself won't do anything. You need to give it to an program (or application or executable) to apply it to your data. The three most likely programs you might use it with are sed, awk and perl. (grep also uses regexes, but that doesn't look like it's for grep.)
Do you know which one you're using?
Also, the trailing g puzzles me. I've only used it in substitutions, s///g, not matches. But perlop says, "The /g modifier specifies global pattern matching--that is, matching as many times as possible within the string. How it behaves depends on the context. ..."
But are you expecting really long lines with multiple matches per line?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.