Request - RegEx 101

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Request - RegEx 101

Post by SkyFrontier »

Hi, people.

I considered writing a guide for beginners (15 days I'm regex-ing a bit more freely, SEEING the pattern-composition) as I believe that teaching is also a way for learning. But I won't be confident enough as regex has an extra complexity, and it is: you'd may achieve what you want, but it won't be necessarily the best or even the safest way. Not to mention the total lack of real case usages worth mentioning...

Something in the fashion I started in an old project on scripting, assuming the user has zero knowledge on the matter, plenty of examples and progressive, accumulative in complexity when it comes to pattern building.

I ask this because over time I have been researching on reference materials and yet their variety is unquestionable, their newbie-friendliness is arguably awful. Then there are flavors. [facepalm]

If i were a highend :wink: user trying to leave a mark-o-the-forum :wink: :wink: , I undoubtedly would take a chance on this waiting for a Don Quijote :P to make it sticky as high as the frontiers of sky.

RegEx is definitely not for beginners. Something should be made about it: its power is astonishing.
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

Stef123

Re: Request - RegEx 101

Post by Stef123 »

Nice timing. Incidentally I've been sorting out my RegEx confusion all morning, so my brain is warmed up and eager to participate.
SkyFrontier wrote:If i were a highend :wink: user trying to leave a mark-o-the-forum :wink: :wink: , I undoubtedly would take a chance on this waiting for a Don Quijote :P to make it sticky as high as the frontiers of sky.
:lol: :mrgreen:

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: Request - RegEx 101

Post by bdeshi »

well, RegExp is the new hot topic of XY beta club! Maybe something nice will come out of it... :tup:
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

Marco
Posts: 2354
Joined: 27 Jun 2011 15:20

Re: Request - RegEx 101

Post by Marco »

SkyFrontier wrote:If i were a highend :wink: user trying to leave a mark-o-the-forum :wink: :wink: , I undoubtedly would take a chance on this waiting for a Don Quijote :P to make it sticky as high as the frontiers of sky.
:D

I don't have the truth in my pockets. What can I say... The syntax is not too difficult, and you can find it pretty much anywhere on the web. But proper usage is another matter, and writing truly optimized regexes requires knowing how a regex engine works.Almost programmer skills - and I'm not a programmer :(
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

Stef123

Re: Request - RegEx 101

Post by Stef123 »

SammaySarkar wrote:well, RegExp is the new hot topic of XY beta club! Maybe something nice will come out of it... :tup:
Hot it may be, but not sexy or alluring. More the kind of hot as in caution-attention warnings, handle with utmost care, expect to get your fingers burned.

Anyway, to get the ball rolling, here my private wiki-notes, complemented with highend's contributions that got me kick-started. Then I quickly realized that this is far more complicated as it pretended to be at the outset. Especially the greedy vs lazy stuff.
RegEx_Syntax.zip
Important note: My RegEx focus is not on XY exclusively. I intend to use it in AHK and FileLocatorPro and ConnectedText and text editors and ..... It's these various sources from which I dumped RegEx help into my private wiki. The attached compilation is my attempt to consolidate all findings into a coherent look-up reference, hoping that I'll finally be able to exercise more control over it.
To see the attached files, you need to log into the forum.
Last edited by Stef123 on 03 Aug 2015 09:23, edited 1 time in total.

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Request - RegEx 101

Post by SkyFrontier »

Hey!
Image
That's a complete start, Stef! What about making it open for public edition, wiki or something?
I don't know other platforms hands on, but have seen some mentioned here, I guess.

>>Visitors interested in learning regex, you should REALLY take a look at the (download link:) attached file in Setf123's previous post!

(I should've made my own version of that pic when I was younger... not that I'm much different now, but the mood is everything.)
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

Stef123

Re: Request - RegEx 101

Post by Stef123 »

Thank you Sky,
very flattering :oops: :titter:
No objections to making this public. Open to anyone to grab whatever he finds useful. My only concern are copyright infringements - it's compiled from various sources, orginally intended for my private info only. Didn't bother to footnote the rightful sources. This might become a problem.

It's a snapshot of an ongoing process, bound to change as I learn. In fact, I already re-shuffled the order of headings - and updated the post above. I use Writing as a Thinking Tool, editing and re-structuring helps me to crystalize thoughts and put them in a logical order, I gather - clarify - reflect - condense - revise ..... an endless loop.

Many things probably don't make sense (not even to myself at the current state of affairs). It's just an exported topic from my overall help project, taken out of context. I removed some broken links, left out files - the upload package exceeded the forum limit.

Garonne
Posts: 195
Joined: 21 Apr 2015 19:10
Location: Win11, 100% Scaling
Contact:

Re: Request - RegEx 101

Post by Garonne »

For anyone who needs a professional approach to RegExes:

I'm regularly using RegexBuddy and RegexMagic from JGsoft.

Both are very useful tools to help you learn RegEx (RegexBuddy) or to get a fast result (RegexMagic).
Both cost 30 € each, but you get a discount for RegexMagic if you already own RegexBuddy (reducing the price to 20 €).

It's especially helpful that both tools offer the option to select the RegEx engine to generate code for... which is especially useful if you need to deal with a RegEx engine you haven't worked with yet and that might have different codes than the ones you usually know (like having to use an old VB RegEx engine *cough*).

EDIT: Will take a look at Stef's file. It's probably a useful (and cheaper) approach but... Just wanted to tell you about those...

Stef123

Re: Request - RegEx 101

Post by Stef123 »

Garonne,
my help topic contains resources I found useful, online tools, freeware, and originally I had also included RegExBuddy and -Magic. Then I decided to delete those links pointing to JGsoft because I could not upload their files anyway (copyright and forum attachment size limit)

However, my notes still contain passages that I drew from JGsoft help files, which I find excellent. Much more advanced than the usual intro stuff, which never covers enough mileage to actually reach real-life destinations. All too soon I always realize I must be missing something - and that's how this whole help topic came to life, birthed by midwives from various forums who gave me directions that I simply compiled and complemented.
Garonne wrote: ... both tools offer the option to select the RegEx engine to generate code for... which is especially useful if you need to deal with a RegEx engine you haven't worked with yet and that might have different codes than the ones you usually know (like having to use an old VB RegEx engine *cough*).
What's the "coughing" all about?
Possibly the answer to my question over there (and also the explanation for this whole thread?):
http://www.xyplorer.com/xyfc/viewtopic. ... 42#p126945

Garonne
Posts: 195
Joined: 21 Apr 2015 19:10
Location: Win11, 100% Scaling
Contact:

Re: Request - RegEx 101

Post by Garonne »

Yeah,

as I mentioned, I hadn't had the time to take a look into your files yet, those two tools were just the first thing that came to my mind when I read the posts.
Stef123 wrote:
Garonne wrote: [...] (like having to use an old VB RegEx engine *cough*).
What's the "coughing" all about?
XY is using an old VB Engine... We've already tried to convince Don to upgrade to something newer without success yet (mostly because of time restraints, if I remember correctly... and low priority...).

Stef123

Re: Request - RegEx 101

Post by Stef123 »

Thanks for filling me in, Garonne,
just had my deja vue - must have asked this before, or at least read about it here in the forum - so Visual Basic 6 is the way to go on the output destination dropdown, right?

highend
Posts: 14953
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Request - RegEx 101

Post by highend »

Visual Basic 6 is the way to go on the output destination dropdown
It's a valid choice (and it shows you what XY doesn't support)
One of my scripts helped you out? Please donate via Paypal

Stef123

Re: Request - RegEx 101

Post by Stef123 »

highend wrote:
Visual Basic 6 is the way to go on the output destination dropdown
It's a valid choice (and it shows you what XY doesn't support)
Thanks. It's these little details that spell success or frustration when things just don't seem to work out.

Post Reply