Very quick regex question

Hi everybody,
I can't seem to figure this out in regex, but can anyone tell me how to use String.split to split a string on every second space?
So, basically, turn this:
aaa bbb cccc dddd eee fff
into:
aaa bbb
cccc dddd
eee fff
Thanks!
Jezzica85

jezzica85 wrote:
Wow! That is by far the craziest regex I've ever seen, but it works like a charm. Thank you promethuzz!You're welcome.
I would never have come up with that on my own, but I did try. I have to say, though, I still don't quite understand all of what's going on in that regex. Would someone please mind explaining one more time what the parts are, and what they do?
Thanks so much!
Jezzica85Did you see reply #6? It pretty much sums it up. In order to understand it, you do need to have a basic knowledge of regex though.
Here's some extra info:
a(?=b)       positive lookahead, matches "a" only when followed by "b", see: http://www.regular-expressions.info/lookaround.html
\\s          a white space character
\\S          a non-white space character (anything but a white space character)
$            the end of the line/String

Similar Messages

  • Very quick your question

    In order to make a flash game, do i start a new actionscript 3.0? and another question (lol)
    when you want to make animate for a flash game, do i make all the animations and save them as seprate the compile all of them when i put the game together? or do i make and animate and do all the stuff simontaniously? like make a background, right after that make the charchter, etc.?
    and once again sorry for my typo'z im Russian...
    FOR MOTHUR RUSSIA!!!!

    You sound like your very inexperieced, Yes as Kglad kindly pointed out yes AS3 is the way to go, but there are a few options on the main interface screen that you may not understand. AS3 is a language, before AS3 there was AS2 and AS1, ig you wish to make a game purely for the internet AS2 will work. Allthough i do not recommend it. AS3 is more advance which also means harder to learn.
    As for animation I personally would not put it in a separate FLA, when you make your player, you would have all you animations for that player inside of it. With stop(); function on the end of the seperate animations, then you would give each animation a frame label so from withi your code when your player dies you can call the death animation, or walk ect. 

  • Very Quick Newb Question - Converting Float to String

    I created a small program that converts currency for the iPhone. Unfortauntely, I cannot get the UILabel to display my float value. Apparently, NS can though. I found a tutorial that told me simply to use this:
    [label setFloatValue:currency];
    label is the UILabel
    currency is the float value
    When I do that with the iPhone SDK, I get this error:
    warning: 'UILabel' may not respond to '-setFloatValue:'
    messages without a matching method signature will be assumed to return 'id' and accept '...' as arguments.
    Any quick advice would be appreciated!
    Message was edited by: hollafortwodollas

    Simple requirements:
    label.text = [NSString stringWithFormat:@"%f", floatValue];
    More complex example:
    NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
    [formatter setFormatWidth:2];
    [formatter setPaddingCharacter:@"0"];
    [formatter setPaddingPosition:NSNumberFormatterPadBeforePrefix];
    lable.text = [NSString stringWithFormat:@"%@:%@:%@",
    [formatter stringFromNumber:[NSNumber numberWithInt:hours]],
    [formatter stringFromNumber:[NSNumber numberWithInt:minutes]],
    [formatter stringFromNumber:[NSNumber numberWithInt:seconds]]];

  • Quick Regex question

    This is a php Regex, but I have a feeling I can find help here...
    I am using this code to convert a [email protected] to <a href="mailto: ..">
    I want to modify it so if there's already a <a href="mailto:...> it will not change it
    My current code is:
    $text = eregi_replace("([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})","<a  href=\"mailto:\\1\">\\1</a>", $text);Help please.
    www.MathLessons.com - When the numbers don't add up.

    This is a php Regex, but I have a feeling I can find
    help here...
    I am using this code to convert a
    [email protected] to <a href="mailto: ..">
    I want to modify it so if there's already a <a
    href="mailto:...> it will not change it
    My current code is:
    $text =
    eregi_replace("([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[
    a-z]{2,3})","<a  href=\"mailto:\\1\">\\1</a>",
    $text);Help please.
    www.MathLessons.com - When the numbers don't add up.Dude... why the hell are you using regex here? There's no point.
    if (!strstr($text, 'href="mailto:"')) {
        $temp = $text;
        $text = '<a href="mailto:"'.$temp.'">';
    }

  • Very quick easy question

    does this board K8N Neo ME- 7030 mobo support dual channel memory?
    thanks

    Memory support depends on the CPU (because the A64 has an integrated memory controller) - nothing to do with the board.
    If that's a socket 754 board then the answer is no. If it's socket 939 then the answer is yes.
    [edit] I got confused by "K8N Neo ME" but now I realise you meant K8N Neo and MS-7030, which is the socket 754 series, so single channel support only.

  • Very quick JMF question

    HI
    I have serached google and a lot of forums and can;t find a simple answer.
    Can the JMF play AVI's encoded in DIVX 5.xx with mp3 sound?
    If yes is there something i have to do to get the JMF player to play them cos it comes up with an error.
    thanks for your help
    Buzz

    Gee Buzzby, it took me 10 seconds.
    http://java.sun.com/products/java-media/jmf/2.1.1/formats.html

  • Very quick novice question

    I have a dual g5 power mac for the first time and on finder there are
    MACHINTOSH HD and
    UNTITLED HD
    Can I store files on the UNTITLED HD as my other HD is nearly full ?
    Only stumped as is empty !

    Hi SIMOCO;
    It appears you have 2 x 250 GB drives. If your first one is almost full it would be a good idea to move files from the first to the second. Good candidates for moving would be any music, movies or photos you might have since they generally take up bunches of disk space.
    You should try to maintain at least 35 GB of free space on the drive.
    I would also suggest you boot from the install media and repair MACINTOSH HD. When you run the free disk space down low the chances of file corruption can increase greatly. If you don't repair this file corruption it can lead to strange problems in the future.
    Allan
    Message was edited by: Allan Eckert

  • Quick REGEXP_LIKE Question

    Hi everyone,
    Had a very quick question: so I need to retrieve all records that have values in this format "type:123;target_id:456". Note that the numeric value can be 1-6 digits long for either type or target_id.
    Can someone please help me with the regexp_like-ing this?
    Thank you,
    Edited by: vi2167 on May 27, 2009 2:06 PM
    Edited by: vi2167 on May 27, 2009 2:07 PM

    WHERE REGEXP_LIKE(val,'type:\d{1,6};target_id:\d{1,6}')SY.

  • Very quick battery drain on mid 2013 macbook air please help!

    hello, my 13" macbook air is losing battery very quickly and i don't know why or what to do...
    i tried to reset the SMC and deleting all my cache files... i have closed all running applications and the battery save preferences are on default...
    I'm running OS X Mavricks and when i first installed it i did get about 14 hours of battery life with normal use, but now i only get as high as 6 hours.
    what can i do to get things back on track?
    thanks to anyone who helps!

    1. Check the cycle count of the battery against the limit for your model. The battery may be due for replacement. If the power adapter is connected almost all the time, the battery may need replacing even though the cycle count is not too high.
    2. Follow these instructions, or these for OS X 10.9 or later.
    3. In the Energy Saver preference pane, uncheck the box marked
    Enable Power Nap while on battery power
    4. You can also try resetting the SMC.
    5. Make sure your system is up to date in Software Update.
    6. Make a "Genius" appointment at an Apple Store, or go to another authorized service center.

  • IOS 8.1.3 - Battery draining very quickly

    Since installing iOS 8.1.3 on my iPhone 6 the battery has started to drain very quickly with little to no use. Anybody else having the same problem

    I too was having some serious battery drain on IOS 8.1.3 on my iPhone 5S. The phone kept getting warm (like I was using maps navigation) I think I just fixed it.  On the hunch that it had to be something with location services I went to the following location in my phones settings: Settings->Privacy->Location Services now scroll all the way down and Click System Services. Disable Cell Network Search, Setting Time Zone, and Wifi Networking. You can also try disabling these one at a time. I really don't need these services so I disabled them all.
    Your phone should now cool down and hold a charge like it did before, mine does. Here are what those settings you are disabling do:
    Cell Network Search:This tracks cell tower usage and congestion, and sends the data back to Apple for analysis as to what towers are being used the most, how you move between cell towers, and which ones are overused. It does not help your phone locate a cell tower. Turning this off will not affect your phone’s performance, according to Apple.
    Setting Time Zone:Your time zone will be instantly adjusted according to your geographic location. Ever notice how as soon as you turn on your phone after a long flight, it displays the local time perfectly, even before getting cell signal? It’s this setting. If you turn it off, you’ll lose that functionality.
    Wi-Fi Networking:This particular setting is interesting, and requires some explanation. As you move around a city, your iPhone is constantly picking up WiFi signals. It geotags that data (“XYZ WiFi is at this GPS location”), encrypts it so that it is anonymous and unique (otherwise the data would look like all hotspots are named “linksys”), and stores it as what Apple calls “crowdsourced Wi-Fi Hotspot locations”. Next time someone walks by that exact hotspot, their iPhone will know where they are without using GPS – because you basically already “marked” the area. Shutting this setting off will stop that info from being sent to Apple. It will not affect your phone’s performance.
    * The above was taken from: http://www.clear-coat.com/blog/iphone-privacy-settings/
    -Joe

  • I can't open the app store, safari the mail app, youtube app and the maps app. they try to open then close very quickly. what can I do?

    I can't open the app store, safari the mail app, youtube app and the maps app. they try to open then close very quickly. what can I do?

    Try downloading another app - any free app - that seems to reset something and the apps may start working again. Try that first. If that doesnt work, try these steps
    Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.
    Reset the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.
    Close all apps. Go to the home screen first by tapping the home button. Quit/close open apps by double tapping the home button and the task bar will appear with all of you recent/open apps displayed at the bottom. Tap and hold down on any app icon until it begins to wiggle. Tap the minus sign in the upper left corner to close the apps. Restart the iPad. Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.

  • Battery BL5C charges and discharges very quickly

    Hi,
    I am using Nokia 1650, Battery BL5C. This battery fully charges in less than 1 hour(the messgae saying battery fully charged pops-up). And this, so-called fully charged battery discharges very quickly, in a days time and mobile gets switched off. Mobile is used only for making and receiving calls which are very few and also i usually do not use it for playing games on it. (Point is, its not so heavily used to discharge the battery so quickly.)
    Is this battery problem or phone's hardware/software problem? I heard its happening to quite a many cell phones.
    The mobile phone I used earlier also had this problem.
    Thanks.

    Try to calibrate it.
    1. Run the battery empty.
    2. Charge it without turning the phone on.
    3. Once battery full, turn it on, and try to charge again until you get the full warning.
    4. Let the battery run till dry again
    5.Charge without turning the phone on
    6. Boot then charge to full
    Battery should be calibrated by then,.
    If you find my post helpful please click the green star on the left under the avatar. Thanks.

  • Hello. after updating to Ios 8 my iPhone is terribly! Discharged very quickly, many transitions between applications, the program takes off, ringtones do not work - works a standard call, the keyboard freezes, bad messages are sent, often loses the n

    Hello. after updating to Ios 8 my iPhone is terribly! Discharged very quickly, many transitions between applications, the program takes off, ringtones do not work - works a standard call, the keyboard freezes, bad messages are sent, often loses the network. what have you done with your phone moym ?! solve all these problems! I beg of you!

    Hello. after updating to Ios 8 my iPhone is terribly! Discharged very quickly, many transitions between applications, the program takes off, ringtones do not work - works a standard call, the keyboard freezes, bad messages are sent, often loses the network. what have you done with your phone moym ?! solve all these problems! I beg of you!

  • I purchased iphone 5 a month back... It get very hot and drained very quickly while playing games . What should i do ??

    I purchased iphone 5 a month back... It get very hot and drained very quickly while playing games . What should i do ??

    Take it in for service at your nearest Apple Store or authorized reseller.

  • Since iOS 7update my IPAD battery Is discharging very quickly what should i do

    Since iOS 7update my IPAD battery Is discharging very quickly what should i do.  This problem only occured since last iOS 7.0.2 update

    Poke around the settings. There's a lot of notifications turned on that you may not need. There's also the backgroun app refresh that will be using battery and the background updating of apps.
    So turn stuff off, if it doesn't help another thing that you can try is to go into the settings and reset all settings. Which is a bit of a pain because you'll need to retweak everything, but sometimes starting fresh can clear glitches

Maybe you are looking for

  • HOW DO I CHANGE THE PITCH OF A MP3 TRACK IN GARAGE BAND 10.0.02

    HOW DO I CHANGE THE PITCH OF A MP3 TRACK IN GARAGE BAND 10.0.02 , i could do it in old version looking at the you tube video, now the screen looks different cant find how to do it. Can some one put up a video please Thanks

  • The mailto client is gone how do I fix it?

    When I click on a email icon firefox does nothing. I looked up how to set my default email but the MAILTO client is gone. Is there a way to fix this?

  • Need more info on like

    I have a department table with following values dept     exclude xxx     y yyy     y zzz n I need to exclude the dept with the string xxx% and yyy% from college table(i.e) first i have to look for records with the values exclude=y (for ex) xxx and yy

  • How can I improve the sound quality of my new iPod?

    Hey there, I just received my new iPod with my new MacBook Pro computer. I have read every bit of documentation i received plus I have scoured resources here on the forum, but I am baffled. I just synced my iPod for the first time to my Macbook, iTun

  • Why doesn't FMLE see my Datavideo HDR-50 through firewire?

    I'm trying to use the firewire output of my Datavideo HDR-50 as an input device for Flash Media Live Encoder but it doesn't see it in the device settings. Are there some parameter settings that need to be changed?