You are not logged in.
Who would ever thought that I will resolve mine problem (question) :lol::lol:
Thank you for giving me the pattern... I experimented a while with moving, editing your RegEx and finally I managed.
Here it is: Expression: "([a-z+])([A-Z])"
Replace: "$1 $2"
Edit: case-sensitive is checked (forgot to mention)
Yeeeah I'm "genius"
Last edited by eR@SeR (2008-04-16 18:12)
TRUTH, FREEDOM, JUSTICE and FATHERLAND are the highest morale values which human is born, lives and dies for!
Offline
Wow, I was sure, that you've misstyped the expression, but I've checked and it works...
Let's figure it out.
+ means "repeated at least once" (BTW: * means "repeated 0 or more times")
[a-z]+ means "any lowercase letter repeated at least once" (eg. a, bk, cat and so on)
Putting + inside [], like you've done [a-z+] means: "any of lowercase letter or + sign" - only one sign - (eg. a, +, b, h, and so on).
And trying that expression:
Expression: ([a-z])([A-Z])
Replace: $1 $2
which also works fine in your case gives us an answer to the problem.
The truth is that we think that in [a-z+] regex is looking for one or more letters, and regex does what it should do: looking for one (and only one) lowercase letter or + sign. So it is a bit of mistake.
Try to see what will happen when you feed both expressions with filename like this "WideLower+Case".
Yours will produce "Wide Lower+ Case"
Mine will produce "Wide Lower+Case"
So the regex finds a lowercase letter followed by the Uppercase letter and inserts a space between them.
And you've definetely improved the regex by swapping parts of expression (no need for second rule what I like most ).
Congratulations!!!
But we have to go one step further and get rid of the + sign, as it is unnecessary and may produce errors.
And now if you get on the idea that what you really need is insiding a space between any sign and UpperCase letter you need that regex (Replace part will be the same):
Expression: ([^A-Z])([A-Z])
[^] - is a negated class, so [^A-Z] means "anything that is not an UpperCase letter".
This will produce "Wide Upper- Case" from "WideUpper-Case"; "Wide Lower& Case" from "WideLower&Case" and so on.
But it won't split UpperCase letters, so it will produce "Wide UPPer Case" from "WideUPPerCase".
Cheers!
And good luck on the way to RegEx's
Ps. WOW, I was just promoted to Senior Member :lol::lol:
Last edited by krtek (2008-04-16 19:19)
Regular Expressions are not as hard to understand as you may think. Check ReNamer's manual or nice Regular Expressions tutorial for more info and start to use full power of applications that use them (like ReNamer, Mp3Tag and so on).
Offline
Thanks for approval
I tested several combinations (including similar to yours for example Tute-WealthLab-English) and it works.
Why shouldn't? Edit: Oh yes, that sign + will make problems (if is in the filename). I tried and I get it the same issue
In fact, like you said, your thinking of one step further is not bad, contrary, it is excellent
But I just wanted to separate low from upper case and that's it. Other characters, for me, doesn't matter. Edit: Erased (it was nonsense )
Like you said this is the right solution:
([a-z])([A-Z]) ----> when you look at this RegEx looks really, really simple
$1 $2 -------------> when you look at this RegEx looks really, really simple
case-sensitive is checked
To be honest I was thinking logicaly what have should be done and for a minute I figure out, it wasn't too hard
Just give me a pattern and I'll make the appropriate changes . For now I can do that. I don't have experience in RegEx "language". Thank you for making things more clear now .
And good luck on the way to RegEx's
Thanks!
Ps. WOW, I was just promoted to Senior Member
Congrats but I'm right behind you, beware
Last edited by eR@SeR (2008-04-16 20:58)
TRUTH, FREEDOM, JUSTICE and FATHERLAND are the highest morale values which human is born, lives and dies for!
Offline
You learn on mistakes. That is the real truth.
In first case, you "wrong". Then I make some combinations from yours RegEx without removing + character which showed good but not excellent because of this possible situation WideLower+Case. Then you finally get into the core of possible problems made by mine modification and managed that really, simple RegEx.
We "lost", but finally get the real and best solution. Applause for us
P.S. This RegEx (mine opinion) are really close with programming which is mine miserable side
Sorry for misunderstandings krtek . There was it from mine side
TRUTH, FREEDOM, JUSTICE and FATHERLAND are the highest morale values which human is born, lives and dies for!
Offline
I like to wander around. You need to be lost if you want to feel that great feeling of finding the right way.
And teamwork makes finding the way even more interesting.
Regexes are far far simpler then any programming language and code. And they are extremally elegant.
They are more like patterns. It is writing an abstract sentence. You don't use words (although you can) but abstract symbols which can be replaced with real words. And when you write this sentence you can move its parts as you would do it with scissors and glue if they were written on a paper.
It takes about two-three days to walk through the tutorial on http://www.regular-expressions.info/ but it is worth to do that.
Thanks for losting together
Regular Expressions are not as hard to understand as you may think. Check ReNamer's manual or nice Regular Expressions tutorial for more info and start to use full power of applications that use them (like ReNamer, Mp3Tag and so on).
Offline
I like to wander around. You need to be lost if you want to feel that great feeling of finding the right way.
And teamwork makes finding the way even more interesting.
Totally agree . I felt that feeling (like I discovered an electricity-power) .
Without teamwork there is no victory .
And when you write this sentence you can move its parts as you would do it with scissors and glue if they were written on a paper.
Something like that . Yes, I understood that in the first place, but only that symbols and making a patterns are making me "troubles" to apprehend...
It takes about two-three days to walk through the tutorial on http://www.regular-expressions.info/ but it is worth to do that.
I don't know will I learn in two-three days . Problems are "trigger force" to make you think about resoving it. Persistence, endurance, work habits... are major principles. If you have them, then you don't know what the word problem is :|:|
Last edited by eR@SeR (2008-04-16 22:29)
TRUTH, FREEDOM, JUSTICE and FATHERLAND are the highest morale values which human is born, lives and dies for!
Offline
Ooohh krtek sorry for making you all these troubles to you and me off course
It was mine mistake for unexploring the rest of topics
There were already answer to mine question at this topic http://www.den4b.com/forum/viewtopic.php?id=426
And Denis have made a script also. http://www.den4b.com/forum/viewtopic.php?id=14
But one is sure. I learnt something more and probably you does, also
Last edited by eR@SeR (2008-04-18 14:30)
TRUTH, FREEDOM, JUSTICE and FATHERLAND are the highest morale values which human is born, lives and dies for!
Offline
It is good to see both of you racing for the most active/supportive user, I really appreciate it!
Offline