Question: My first post here and it "obviously" has to be about regexp (the nightmare of all beginner devs)

I have a string: `s = "Shadowborn Apostle \r\nCreature — Human Cleric \r\nA deck can have any number Of \r\ncards named Shadowborn Apostle. \r\ne, Sacrifice six creatures named \r\nShadowborn Apostle: Search your \r\nlibrary for a Demon creature card \r\nand put it onto the battlefield. Then \r\nshuffle your library. \r\n"`

I would like to extract only this part `Shadowborn Apostle(space)`

I use .match to get the substring I want: `s.match(/^[^\\]+/)`

Unfortunately, MatchData = the whole string. And I'm not sure why. Any help would be appreciated.

Thanks!

Answer: 
I found a solution in [Alamofire repository issues](https://github.com/Alamofire/Alamofire/issues/1684)

> 
> **jshier** commented on Oct 10, 2016
> 
> 
> An unexpected error -999 almost always means your SessionManager was
> deallocated, cancelling any ongoing requests. I suggest you create a
> singleton value for your custom SessionManager, or perhaps just
> reevaluate if you really need one.
> 
> 
> 

if you create a singleton value for your object it remains in memory and prevent from deallocate

and another thing that i avoid is to name your variables diffrent, a sessionManager is in Alamofire and your variable is also called sessionManager.

Alamofire 4.7 , Swift 4
-----------------------

```
import Alamofire

class Networking {

  public static let sharedManager: SessionManager = {
      let configuration = URLSessionConfiguration.default
      configuration.timeoutIntervalForRequest=20
      let manager = Alamofire.SessionManager(configuration: configuration, delegate: SessionManager.default.delegate)
      return manager
  }()
}

```

Alamofire 5.0.0-beta.6 , Siwft 5.1
----------------------------------

```
import Alamofire

class Networking {

  static let APIManager: Session = {
      let configuration = URLSessionConfiguration.default
      configuration.timeoutIntervalForRequest = 20
      let delegate = Session.default.delegate
      let manager = Session.init(configuration: configuration,
                                 delegate: delegate,
                                 startRequestsImmediately: true,
                                 cachedResponseHandler: nil)
      return manager
  }()
}

```
Most probably your SessionManager was deallocated, cancelling any ongoing requests. try to assign the session manager instance to a property.

check
<https://github.com/Alamofire/Alamofire/issues/1684>